PDA

View Full Version : Another way to fail spectacularly in Linux



Chebmaster
08-10-2020, 07:51 PM
FindFirst(path + '*.*', faDirectory, SearchRec)
Windows is patient and kind to fools and maybe allows this travesty for historical reasons.
Linux is not.

In Windows, *.* means any file. In Linux, any file that has a period in its name.
Your code won't see any of the folders it tries to list.
Use '*', Luke.

de_jean_7777
08-10-2020, 09:05 PM
Learned that quite a while ago. Which is why I have a few {$IFDEF UNIX} in my code now :D

Ñuño Martínez
10-10-2020, 09:42 AM
Good point.

Maybe that's the reason my engine's file finder doesn't work as expected on Windows but does in Linux. Should revisit it.

SilverWarior
12-10-2020, 10:00 PM
In Windows, *.* means any file. In Linux, any file that has a period in its name.

More accurate would be that on Windows *.* means file with any name and any file extension.
But unlike Windows Linux does not use file extensions. When on Linux you see file which appears to have an extension like "file.txt" that is not a file with an "txt" extension but only a file whose name contains ".txt" at the end.