File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -435,7 +435,12 @@ module_t* create_module(char* path)
435
435
char * path3 = path2 ;
436
436
for (char * s = path2 ; * s ; ++ s ) if (* s == '/' ) path2 = s + 1 ;
437
437
for (char * s = path2 ; * s ; ++ s ) if (* s == '.' ) { * s = '\0' ; break ; }
438
- path2 [-1 ] = '\0' ;
438
+ if (path2 != path3 ) {
439
+ path2 [-1 ] = '\0' ;
440
+ path3 = lowercase (path3 );
441
+ } else {
442
+ path3 = NULL ;
443
+ }
439
444
mod -> prefix = lowercase (path2 );
440
445
mod -> dir = path3 ;
441
446
mod -> tree = NULL ;
@@ -3289,10 +3294,12 @@ void _compute_modules(ast_list_t* A, module_t* m)
3289
3294
* i = '\0' ;
3290
3295
for (module_list_t * mm = m -> uses ; mm ; mm = mm -> next )
3291
3296
if (!strcmp (mm -> mod -> prefix , mod_name )) goto end ;
3292
- char * filename = alloc (strlen (m -> dir ) + strlen (mod_name ) + 6 );
3297
+ char * filename = alloc (( m -> dir ? strlen (m -> dir ) : 0 ) + strlen (mod_name ) + 6 );
3293
3298
* filename = '\0' ;
3294
- strcpy (filename , m -> dir );
3295
- strcat (filename , "/" );
3299
+ if (m -> dir ) {
3300
+ strcpy (filename , m -> dir );
3301
+ strcat (filename , "/" );
3302
+ }
3296
3303
strcat (filename , mod_name );
3297
3304
strcat (filename , ".cog" );
3298
3305
module_t * M = create_module (filename );
You can’t perform that action at this time.
0 commit comments