Working with multiple Purebasic versions...
Posted: Fri Dec 28, 2012 9:24 am
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)
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