Skip to content
This repository was archived by the owner on Jul 12, 2021. It is now read-only.

Commit 65a7660

Browse files
author
ShadauxCat
committed
-Allowed loading files with extensions other than ".dao" using the syntax:
load "modulename.ext"
1 parent 1240241 commit 65a7660

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

kernel/daoVmspace.c

+6
Original file line numberDiff line numberDiff line change
@@ -1846,6 +1846,12 @@ int DaoVmSpace_CompleteModuleName( DaoVmSpace *self, DString *fname, int types )
18461846
}else if( (types & DAO_MODULE_DLL) && size > slen && DString_FindChars( fname, DAO_DLL_SUFFIX, 0 ) == size - slen ){
18471847
DaoVmSpace_SearchPath( self, fname, DAO_FILE_PATH, 1 );
18481848
if( DaoVmSpace_TestFile( self, fname ) ) modtype = DAO_MODULE_DLL;
1849+
//If we're given a filename (i.e., if it has an extension) and it's not a known filetype, load it anyway.
1850+
//With custom syntaxes people can use custom extensions, and we should allow them to load with those.
1851+
//In this case, always treat the extension as DAO_MODULE_DAO; that's all we'll support for custom extensions.
1852+
}else if( (types & DAO_MODULE_DAO) && size >1 && DString_FindChars( fname, ".", 0 ) != -1 ){
1853+
DaoVmSpace_SearchPath( self, fname, DAO_FILE_PATH, 1 );
1854+
if( DaoVmSpace_TestFile( self, fname ) ) modtype = DAO_MODULE_DAO;
18491855
}else{
18501856
DString *fn = DString_New();
18511857
DString *path = DString_New();

0 commit comments

Comments
 (0)