Ok, I improved the sources.
I have created a new unit —
Platformer.Files.pp — in which is located the class preparing the paths.
First set of methods is used to convert a given path to native, always absolute, using native directory separators. These methods have protection against the multiple addition of the prefix in the form of an executable file path.
The second set of methods is used to check whether a file with a given path is on the disk. First, they prepare the path using the above methods, and then check the existence of the file with the standard
FileExists function.
This class is used in all of my own classes having the
LoadFromFile method and in other places where relative paths from constants are used. So, generally, everytime when the path to the file must be used, the
TFiles.MakePath method is used. It is universal and convenient, because we can use both relative and absolute path, and in the result, always we will get the correct absolute path equipped with the native directory separator.
The improved sources are in the attachment. First new feature is the new mechanism for preparing the paths, and the second is the new clock mechanism, which should work on any of Unix-like systems. In addition better than this for Windows, because of using the
FPNanoSleep to make delays between frames.
So, if you want to test, go ahead. You can test current sources on any operating system (
Windows,
Linux,
BSD,
Solaris and
macOS) but, I care most about tests on non-Windows systems. In particular on
macOS, because it has not yet been able to compile and run on this system (and now it is probably possible).
Feedback is welcome.
