Page 1 of 1

Portable PureBasic

Posted: Sat Mar 08, 2008 3:08 pm
by greyhoundcode
Does anyone know, or has anyone tried and succeeded, in installing the PureBasic IDE and compiler to a USB pen drive, thus allowing them to take their compiler and projects with them to other computers?

Posted: Sat Mar 08, 2008 3:19 pm
by #NULL
many people do this (i don't). there is a chapter in the help manual about the IDE commandline parameter.
..the /PORTABLE one is that for.

http://www.purebasic.com/documentation/ ... dline.html

Posted: Sat Mar 08, 2008 6:13 pm
by Baldrick
Yes, PB runs fine from a usb drive.

Copy your entire PB directory to your pen drive & add a compiled copy of the code below into the main PB directory on this pen drive. Use this to start it instead of the main PB.exe directly & it will run using localised preferences, etc.

At least this works for me.. :)

Code: Select all

If ReadFile(0,"PureBasic.exe") 
 If RunProgram("PureBasic.exe","/PORTABLE","PureBasic")=0  
  MessageRequester("Fault","PB failed to open") 
 EndIf 
  Else 
 MessageRequester("Fault","PureBasic.exe file not found") 
EndIf 

Thanks

Posted: Sun Mar 09, 2008 11:34 am
by greyhoundcode
Thanks for that, it's pretty straightforward after all then :roll:

Posted: Tue Mar 11, 2008 9:08 am
by Tranquil
What is the difference with /portable flag? I have a copy on my stick too and I run it successfully with out the flag set.

Posted: Tue Mar 11, 2008 12:53 pm
by #NULL
pb will not put the (tool)prefs and templates in the systems %APPDATA%\PureBasic\ directory, but stead in the pb-dir directly (i.e. on the stick), and it won't write in the registry, so the system will not be touched.

Posted: Tue Mar 11, 2008 1:50 pm
by ts-soft
Here my simple "PureBasic portable" exe:

Code: Select all

RunProgram(GetPathPart(ProgramFilename()) + "PureBasic\PureBasic.exe", "/PORTABLE", GetPathPart(ProgramFilename()) + "PureBasic\")

Re: Portable PureBasic

Posted: Sun Jun 24, 2018 4:47 pm
by Jeromyal
I know this is a very old post but I decided I might as well contribute my flavor.

Code: Select all

; Works well with PortableApps.com's portable app launcher, or the root of a thumb drive.
; place this application inside a folder or root of a drive.
; Once launched it will create some companion folders and explain where to install PureBasic.

; Suggestion would be to also address the command line of tools with a relative path like ..\Tools\<tool>
; and
; perhaps edit your [Explorer] Fav? = paths of PureBasic.prefs with relative paths as well for an even more portable PureBasic.
;
; Example:
;
; [Explorer]
; Mode = 0
; Pattern = 0
; SavePath = 1
; ShowHidden = 1
; Splitter = 115
; Path = ..\Projects\
; Favorites = 3
; Fav1 = ..\Projects\
; Fav2 = ..\tools\
; Fav3 = .\Examples\
; 
;
; I created the seperate directorys so that if I ever wanted, I could delete the entire PureBasic directory and do a fresh install for what ever reason and I would still maintain preferences.
;

Path$ = ".\PureBasic\PureBasic.exe"

Working$ = ".\PureBasic\"   

Param$ = "/P " + Chr(34) + "..\Preferences\PureBasic.prefs" + Chr(34) + 
         "/T " + Chr(34) + "..\Preferences\Templates.prefs" + Chr(34) + 
         "/H " + Chr(34) + "..\Preferences\History.db" + Chr(34) +  
         "/A " + Chr(34) + "..\Preferences\Tools.prefs" + Chr(34) +
         "/NOEXT" + Chr(34) 

CreateDirectory(".\Preferences\")
CreateDirectory(".\Projects\")
CreateDirectory(".\Projects\Includes\")
CreateDirectory(".\Tools\")
CreateDirectory(".\PureBasic\")

If Not RunProgram(Path$,Param$,Working$)
  MessageRequester("PureBasic Application Not Found" , 
                   "Please install PureBasic into path: " + Chr(34) + GetPathPart(ProgramFilename()) + Chr(34) + 
                   Chr(13) + Chr(10) + Chr(13) + Chr(10) + 
                   "The install path should look like " + Chr(34) + GetPathPart(ProgramFilename()) + "PureBasic\" + Chr(34) + 
                   Chr(34) + Chr(13) + Chr(10) + Chr(13) + Chr(10) + 
                   "You should also get a warning that the folder " + Chr(34) + "PureBasic" + Chr(34) + " already exists.", #PB_MessageRequester_Warning | #PB_MessageRequester_Ok)
  ;Result = RunProgram(Filename$ [, Parameter$, WorkingDirectory$ [, Flags [, SenderProgram]]])
EndIf