B4J Question Compiler question

rspitzer

Active Member
When compiling a program is there a way to tell the compilation process whether its compiling for windows or linux? To be more specific about this, the issue is with file directories and the usage of either the "/" or "\" in a directory statement. What I would like to do is assign a path statement to a variable, this path statement would be different for windows or linux, but is there a way to have the compiler use one of the two path statements? Depending on whether this is windows or linux?
 

OliverA

Expert
Licensed User
Longtime User
Use File.Combine to build your path statements. It will take care of using the appropriate, platform specific path separator.
 
Upvote 0

rspitzer

Active Member
Thanks for the tip on file.combine, I will look into that. Kinda outside the box thinking, nice. I was kinda hoping for something more direct. I use fixed pre defined directories for my data, so I was thinking after seeing a lot of hashtag directives in other posted code here I could do something like:

(not real code here)

if windows then
Public data_directory = "c:\mydirectory\mydata\data\" As String
end if
if linux then
Public data_directory = "/home/ubuntu/mydata/data/" As String
end if

Thanks for the replies though.
 
Upvote 0
Top