I have prepared the source code from the beginning to work platform-independently. However, external libraries are not portable, and one of the things that need to be done is to collect the necessary platform-specific files. I will guide you on how to do that using SharpDevelop or MonoDevelop.
But even before this can be done, there are still problems in porting the program to other OSs. One thing is file names and file systems.
There are several occasions where path names are constructed in the program. The example code System.IO.Path.Combine(TrainFolder, TrainName) is used to combine the train folder (e.g. C:\Program Files\openBVE\Train) with the train name (e.g. 113_6), resulting in C:\Program Files\openBVE\Train\113-6 on Windows. The same function will instead use the slash character on Linux and Mac, so it is a platform-safe function, and I solely use these kinds of functions provided by the .NET framework.
However, in object files, a LoadTexture command might reference the relative file name ..\texture.bmp, which when combined with the base object folder (e.g. C:\Program Files\openBVE\Railway\Object) will yield C:\Program Files\openBVE\Railway\Object\..\texture.bmp. When accessing this file, the file will be correctly found under C:\Program Files\openBVE\Railway\texture.bmp, thus resolving the ".." part. On Linux or Mac, this could instead become something like /openBVE/Railway/..\texture.bmp, which might not be processable in those OS's due to the backslash character.
I have therefore started to correct all path parts read from text files in order to convert from the backslash character to the slash character on Linux and Mac. This means that the game EXE itself cannot be cross-platform, as conditional compilation is required (which is required anyway, just to mention that).
What I want to do with this thread is to collect system-specific problems that I have missed to see, and which might prevent using the program on other OSs.
Things I have investigated and prepared so far:
Mac OS X:
The path separation character is the slash (/). Path parts read from text files will replace their backslash characters to slash characters.
Linux:
The path separation character is the slash (/). Path parts read from text files will replace their backslash characters to slash characters.
Furthermore, file names are case-sensitive, which might prevent the program to find files referenced in a route file when the actual files use a different case for some characters. The solution already partially implemented is to test if the file exist in the spelling used, and if not, the path will be split into two parts: The directory and the pure file name. First, the directory name will be recursively edited with the process described hereby. Second, once the directory name is valid, all files in the directory are checked if they match case-insensitively. Once a file has been found, that file name is returned instead of the original one, so that the file can be found by subsequeny processes. The directory is recursively edited in the same way by checking the parent directories until a match is found. If no match is found in any of the processes, then the file does not exist anyway regardless of the spelling
If there are any other considerations or any parts I mentioned here unnecessary, please tell me.
And of course, almost needless to say, BVE 4 ATS DLL plugins cannot work on other OSs but Windows. Trains will still be usable, just without the plugin.
