Page 1 of 1

Working with multiple Purebasic versions...

Posted: Fri Dec 28, 2012 9:24 am
by Michael Vogel
I don't remove "old" purebasic versions and also like to test new (beta) releases. But which version should be started, when double clicking on a source file in the windows explorer?

I orded my Purebasic releases in directories, like "Pure.431", "Pure.441", "Pure.451" etc. and changed all extensions of the "PureBasic.exe" to something else (e.g. "PureBasic.eve").

Then, I wrote a simple program (with the filename PureBasic.exe, but to simplify all, I call it "starter" here), which is located in a seperate "PureBasic" directory (you can also copy the starter to all Pure.xxx directories) and is assigned to be started when I double click on a PureBasic file.

A "PureBasic.ini" in the "PureBasic" directory shows, which version should be started by default:
_____________

Shift=510
Version=500
_____________

Now you have the following possibilities:
• using the starter in the "PureBasic" directory starts the default version of Purebasic, holding shift/control starts alternative versions
• using the starter in local directories (e.g. "Pure.500") starts the local version of Purebasic
• double click on a purebasic file loads the file into the default version of Purebasic (holding shift/control for alternative versions)

Code: Select all

Global Path.s
Global Version.s
Global Parameter.s
Global n

Path=GetPathPart(ProgramFilename())

Parameter=PeekS(GetCommandLine_())
n=FindString(Parameter,#DQUOTE$,2)


If n
	OpenPreferences(Path+"Purebasic.ini")
	
	Version=ReadPreferenceString("Version","")
	
	If GetKeyState_(#VK_SHIFT)&128
		Version=ReadPreferenceString("Shift",Version)
	EndIf
	If GetKeyState_(#VK_CONTROL)&128
		Version=ReadPreferenceString("Control",Version)
	EndIf
	
	ClosePreferences()
	
	If Len(Version)
		Path+"..\Pure."+Version
	EndIf
	SetCurrentDirectory(Path)
		
	RunProgram("Purebasic.eve","/Portable "+Trim(Mid(Parameter,n+1)),".")
EndIf

Re: Working with multiple Purebasic versions...

Posted: Fri Dec 28, 2012 12:24 pm
by idle
on Linux I create an exe on my desktop for each PB version

Code: Select all

SetEnvironmentVariable("PUREBASIC_HOME","/home/idle/purebasicXXX")
RunProgram("/home/idle/purebasicXXX/compilers/purebasic","","",#PB_Program_Wait)

Re: Working with multiple Purebasic versions...

Posted: Fri Dec 28, 2012 12:24 pm
by Fred
You can also use the same IDE with several compiler versions.

Re: Working with multiple Purebasic versions...

Posted: Fri Dec 28, 2012 12:33 pm
by idle
Fred wrote:You can also use the same IDE with several compiler versions.
I think I can admit I have a bad memory :oops:

Preferences -> Compiler
Browse (for pbcompiler)
Add

Re: Working with multiple Purebasic versions...

Posted: Fri Dec 28, 2012 12:37 pm
by Puffolino
I've stopped mixing different versions because of their different User Libs and help files. But where's the advantage for an extra start program?