Portable PureBasic

Everything else that doesn't fall into one of the other PB categories.
User avatar
greyhoundcode
Enthusiast
Enthusiast
Posts: 108
Joined: Sun Dec 30, 2007 7:24 pm

Portable PureBasic

Post 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?
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Post 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
Baldrick
Addict
Addict
Posts: 860
Joined: Fri Jul 02, 2004 6:49 pm
Location: Australia

Post 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 
User avatar
greyhoundcode
Enthusiast
Enthusiast
Posts: 108
Joined: Sun Dec 30, 2007 7:24 pm

Thanks

Post by greyhoundcode »

Thanks for that, it's pretty straightforward after all then :roll:
Tranquil
Addict
Addict
Posts: 950
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post 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.
Tranquil
#NULL
Addict
Addict
Posts: 1440
Joined: Thu Aug 30, 2007 11:54 pm
Location: right here

Post 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.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Here my simple "PureBasic portable" exe:

Code: Select all

RunProgram(GetPathPart(ProgramFilename()) + "PureBasic\PureBasic.exe", "/PORTABLE", GetPathPart(ProgramFilename()) + "PureBasic\")
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Jeromyal
Enthusiast
Enthusiast
Posts: 208
Joined: Wed Jul 17, 2013 8:49 am

Re: Portable PureBasic

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