Working with multiple Purebasic versions...

Share your advanced PureBasic knowledge/code with the community.
User avatar
Michael Vogel
Addict
Addict
Posts: 2797
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Working with multiple Purebasic versions...

Post 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
User avatar
idle
Always Here
Always Here
Posts: 5836
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Working with multiple Purebasic versions...

Post 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)
Windows 11, Manjaro, Raspberry Pi OS
Image
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Working with multiple Purebasic versions...

Post by Fred »

You can also use the same IDE with several compiler versions.
User avatar
idle
Always Here
Always Here
Posts: 5836
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Working with multiple Purebasic versions...

Post 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
Windows 11, Manjaro, Raspberry Pi OS
Image
Puffolino
User
User
Posts: 49
Joined: Thu Jan 05, 2012 12:27 am

Re: Working with multiple Purebasic versions...

Post 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?
Post Reply