|
Post by donnybowers on Feb 24, 2019 23:48:01 GMT -5
Anyone have any tips for those who want to develop cross platform programs?
Here's one to start off:
Unlike Windows, the Linux file system is case sensitive. So if you have a file named "MyFile.txt" that your program opens when it's run; you need to name it exactly that in your program. If you try to open "MyFile.txt" with "myfile.txt" or MYFILE.TXT", you will get an error (in Linux) like "No such file or directory".
Be sure to use unique file and folder names as always for files you don't want overwritten; but also make sure that the filename case is the same in the program as it is in the file itself. The same is true for executing outside programs or any place where a file name is used to open or execute a file.
|
|
|
Post by Chris Iverson on Feb 25, 2019 0:44:53 GMT -5
The biggest problem is going to be folder paths.
Windows uses a backslash(\) as a path separator.
Linux uses a forward slash(/).
Using the wrong one in LB5 will cause it to not find the path you're looking for, or create a file with slashes in the name, or some other weird behavior. Folder paths are NOT automatically translated between systems.
|
|
|
Post by metro on Feb 25, 2019 1:55:07 GMT -5
The biggest problem is going to be folder paths. Windows uses a backslash(\) as a path separator. Linux uses a forward slash(/). Using the wrong one in LB5 will cause it to not find the path you're looking for, or create a file with slashes in the name, or some other weird behavior. Folder paths are NOT automatically translated between systems. I use this with Runbasic
if Platform$="unix" then slash$="/" else slash$="\" end if
|
|
|
Post by donnybowers on Feb 25, 2019 2:29:24 GMT -5
metro said:
I like that method. Then just use slash$ wherever you would otherwise have a slash or backlash.
fileName$="MyFolder"+slash$+"MyFile.txt"
open fileName$...
|
|