It is currently Sun May 26, 2013 4:31 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Simple time saver for multi os compiling
PostPosted: Wed Jul 20, 2011 6:23 am 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 1620
Location: USA
Code:
CompilerIf #PB_Compiler_OS = #PB_OS_Linux Or #PB_OS_MacOS
  #Slash$ = "/"
CompilerElse
  #Slash$ = "\"
CompilerEndIf


Code:
Pic1: IncludeBinary "game data" + #Slash$ + "image.png"


I just got tired of editing the code everytime I switched back and forth from a different OS. ;)

_________________
AMD 64 4000+ / 1GB PC2700 / WIN XP Home SP3 / Nvidia GT220 x16 512MB / M-Audio Revolution 5.1
Macbook Air 11.6" - 2010 / OS X 10.8

http://www.posemotion.com
http://www.flashpulse.com


Top
 Profile  
 
 Post subject: Re: Simple time saver for multi os compiling
PostPosted: Wed Jul 20, 2011 12:25 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 31, 2005 11:09 pm
Posts: 2242
Location: Italy
The compilerif should be

Code:
CompilerIf #PB_Compiler_OS = #PB_OS_Linux Or #PB_Compiler_OS = #PB_OS_MacOS


otherwise it doesn't work (always true).

Probably it's shorter to reverse the thing and test for "windows or else" anyway :)

_________________
[ Home ] [ My PC ] [ New to PB ? ]


Top
 Profile  
 
 Post subject: Re: Simple time saver for multi os compiling
PostPosted: Wed Jul 20, 2011 1:21 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jun 28, 2003 12:01 am
Posts: 349
Some additional Information:

cite from msdn:
Microsoft MSDN wrote:
Note:
File I/O functions in the Windows API convert "/" to "\" as part of converting the name to an NT-style name, except when using the "\\?\" prefix as detailed in the following sections.

History: Why is the DOS path character "\"?

_________________
Windows 8 / Windows 7 / Windows XP (als VM)
PB Last Final / Last Beta Testing


Top
 Profile  
 
 Post subject: Re: Simple time saver for multi os compiling
PostPosted: Wed Jul 20, 2011 6:32 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 1620
Location: USA
luis wrote:
The compilerif should be

Code:
CompilerIf #PB_Compiler_OS = #PB_OS_Linux Or #PB_Compiler_OS = #PB_OS_MacOS


otherwise it doesn't work (always true).

Probably it's shorter to reverse the thing and test for "windows or else" anyway :)

Why do you say that? It works just fine here on my Mac and my XP pc. Did it not work for you? What OS are you using?

_________________
AMD 64 4000+ / 1GB PC2700 / WIN XP Home SP3 / Nvidia GT220 x16 512MB / M-Audio Revolution 5.1
Macbook Air 11.6" - 2010 / OS X 10.8

http://www.posemotion.com
http://www.flashpulse.com


Top
 Profile  
 
 Post subject: Re: Simple time saver for multi os compiling
PostPosted: Wed Jul 20, 2011 6:52 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 31, 2005 11:09 pm
Posts: 2242
Location: Italy
J. Baker wrote:
Why do you say that? It works just fine here on my Mac and my XP pc. Did it not work for you? What OS are you using?


I would say It seem to work, since the "/" works anyway in normal paths under Windows too.

You are writing "IF[condition] OR TRUE".

Code:
CompilerIf #PB_Compiler_OS = #PB_OS_Linux Or #PB_OS_MacOS
  #Slash$ = "/"
CompilerElse
  #Slash$ = "\"
CompilerEndIf

Debug #Slash$


What does your XP machine prints ?

_________________
[ Home ] [ My PC ] [ New to PB ? ]


Top
 Profile  
 
 Post subject: Re: Simple time saver for multi os compiling
PostPosted: Wed Jul 20, 2011 7:11 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 1620
Location: USA
What the hell! :shock:

I didn't know that a "/" would work in Windows. I'll be a monkeys ass. :oops:

Quote:
What does your XP machine prints ?

Not sure what you are asking here?

_________________
AMD 64 4000+ / 1GB PC2700 / WIN XP Home SP3 / Nvidia GT220 x16 512MB / M-Audio Revolution 5.1
Macbook Air 11.6" - 2010 / OS X 10.8

http://www.posemotion.com
http://www.flashpulse.com


Top
 Profile  
 
 Post subject: Re: Simple time saver for multi os compiling
PostPosted: Wed Jul 20, 2011 7:20 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 31, 2005 11:09 pm
Posts: 2242
Location: Italy
J. Baker wrote:
Not sure what you are asking here?


Just read my previous post, and try what I included between the CODE tags. All should be clear then (the reason why the compilerif you wrote is wrong). :wink:

_________________
[ Home ] [ My PC ] [ New to PB ? ]


Top
 Profile  
 
 Post subject: Re: Simple time saver for multi os compiling
PostPosted: Wed Jul 20, 2011 7:50 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 1620
Location: USA
luis wrote:
J. Baker wrote:
Not sure what you are asking here?


Just read my previous post, and try what I included between the CODE tags. All should be clear then (the reason why the compilerif you wrote is wrong). :wink:

Sorry, didn't see you had Debug there.

Interesting! It gave me a "/". I guess it is always true then like you said. Being that Windows can be "/" or "\".

Well luis, I have to thank you for the tip today. Thanks! ;)

_________________
AMD 64 4000+ / 1GB PC2700 / WIN XP Home SP3 / Nvidia GT220 x16 512MB / M-Audio Revolution 5.1
Macbook Air 11.6" - 2010 / OS X 10.8

http://www.posemotion.com
http://www.flashpulse.com


Top
 Profile  
 
 Post subject: Re: Simple time saver for multi os compiling
PostPosted: Thu Jul 21, 2011 3:29 am 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 933
Location: New York
:) J., I do the exact same thing in a lot of my programs (except I keep the constant name short: #PS$ for Path Separator).

I was somewhat-aware that "/" usually works on Windows, but I still use an OS-dependent delimiter because you don't want your user to see non-native path characters! (whether in your GUI, a saved file, etc. etc.)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye