gintool / gin

GI in No Time - a Simple Microframework for Genetic Improvement
MIT License
43 stars 20 forks source link

Symbolic links cause problems with filenames #86

Closed sandybrownlee closed 1 year ago

sandybrownlee commented 2 years ago

If your target application sits in a directory referenced by a symbolic link, e.g. /home -> /lfs/raid1-0/home

and you try to make a new SourceFile object, then call Sourcefile.getFilename(), you'll get an empty string.

This is because Sourcefile.getFilename() (line 90 on) uses substringafter to strip the working directory from the filename, but the working directory will get resolved to the absolute path rather than the logical path. The symbolic link means these don't match, so substringafter returns an empty string.

Can probably be resolved by changing the calls the getAbsolutePath(); or possibly doing something less weird than substringafter().

GiovaniGuizzo commented 1 year ago

Fixed with commit 790c082248dfb223e211064fde29104d098224b9