Recent

Author Topic: Lazarus Portable for Windows  (Read 18794 times)

OLLI_S

  • Full Member
  • ***
  • Posts: 119
Lazarus Portable for Windows
« on: May 23, 2015, 02:07:00 pm »
Hello,

I am programming at home a small tool that I use at work.
My boss gave me the permission to continue coding at work, but at work I am not allowed to install any software.
But I can execute EXE applications (that do not need to be installed).

So, is there a portable version of Lazarus for Windows?
This is the only way how I can use Lazarus at work!

Greetings

OLLI

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Lazarus Portable for Windows
« Reply #1 on: May 23, 2015, 02:52:20 pm »
Install Lazarus into a directory for which you have write permission, e.g. you home directory; the only problem is that its name should not contain spaces, i.e. the old "c:\Documents and settings\<username>" is not good, but the "c:\users\<username>" of Windows7+ is fine. Maybe you even can install to "c:\Lazarus" as the installation program proposes. The only thing to remember is: Don't install to "c:\program files" - you'll need administrative rights for that.

And you should not allow the installer to register the typical file types with Lazarus because this will be written to the registry for which you might not have the permission.
« Last Edit: May 23, 2015, 03:11:11 pm by wp »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: Lazarus Portable for Windows
« Reply #2 on: May 23, 2015, 03:13:25 pm »
The new (1.4) installer also has an option to specify  the location of the configuration yourself, without needing to write into the profile.

If the installer won't run, install it at home to a certain location (e.g. c:\lazarus with the configuration in c:\lazarus\config) and archive and decompress that at work.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Lazarus Portable for Windows
« Reply #3 on: May 23, 2015, 03:24:12 pm »
Marco, how can it be achieved that the installer does not write absolute file paths into the config files but refers to "$(LazarusDir)" etc.? In my experience this is the main blocking point for getting a really portable installation.

Examples:
fpc.cfg:
# searchpath for units and other system dependent things
-Fud:\lazarus14_fpc264\fpc\$FPCVERSION/units/$fpctarget
-Fud:\lazarus14_fpc264\fpc\$FPCVERSION/units/$fpctarget/*
-Fud:\lazarus14_fpc264\fpc\$FPCVERSION/units/$fpctarget/rtl

environmentoptions.xml:
<MakeFilename Value="D:\lazarus14_fpc264\fpc\2.6.4\bin\i386-win32\make.exe">

...etc

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: Lazarus Portable for Windows
« Reply #4 on: May 23, 2015, 03:30:28 pm »
Afaik it can't.

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Lazarus Portable for Windows
« Reply #5 on: May 23, 2015, 03:56:22 pm »
I believe Blaise Pascal Magaazine (follow the Bookstore link in the left sidebar of the forum page) offers a USB memory stick pre-loaded with a portable version of Lazarus that can be run from any USB port, i.e. it is 'installed' on the memory stick, rather than on a hard drive.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Lazarus Portable for Windows
« Reply #6 on: May 23, 2015, 03:58:23 pm »
you can install it on an external drive that has a drive letter that is the same both at work and home computers eg Z:
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Roland57

  • Sr. Member
  • ****
  • Posts: 423
    • msegui.net
Re: Lazarus Portable for Windows
« Reply #7 on: May 23, 2015, 06:15:43 pm »
Hello! Here is my humble contribution. I installed Lazarus 1.4 on a USB key (without file type association). The Lazarus directory is E:\lazarus. I create a directory named E:\lazarus-config and selected it (during intallation) as the configuration directory.

Now, when I am at work, sometimes the drive letter of the USB key is F:\. So I wrote a little Lua script that searches in configuration files all pathes and replaces the drive letter. Then I run Lazarus with a CMD script. The Lua script and the CMD script are in the main directory of the USB key, since they take the drive letter from their own path. I attach the both scripts. Maybe it will be useful to someone or maybe you will help me to improve them.

Code: [Select]
update(extractfiledrive(arg[0]) .. "\\lazarus\\fpc\\2.6.4\\bin\\i386-win32\\fpc.cfg")
update(extractfiledrive(arg[0]) .. "\\lazarus-config\\environmentoptions.xml")
update(extractfiledrive(arg[0]) .. "\\lazarus-config\\fpcdefines.xml")
update(extractfiledrive(arg[0]) .. "\\lazarus-config\\editoroptions.xml")
update(extractfiledrive(arg[0]) .. "\\lazarus-config\\idemake.cfg")
update(extractfiledrive(arg[0]) .. "\\lazarus-config\\inputhistory.xml")
update(extractfiledrive(arg[0]) .. "\\lazarus\\environmentoptions.xml")
update(extractfiledrive(arg[0]) .. "\\lazarus\\lazarus.cfg")

« Last Edit: May 23, 2015, 08:40:27 pm by Roland Chastain »
My projects are on Gitlab and on Codeberg.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Lazarus Portable for Windows
« Reply #8 on: May 23, 2015, 07:07:55 pm »
Hello! Here is my humble contribution. I installed Lazarus 1.4 on a USB key (without file type association). The Lazarus directory is E:\lazarus. I create a directory named E:\lazarus-config and selected it (during intallation) as the configuration directory.

Now, when I am at work, sometimes the drive letter of the USB key is F:\. So I wrote a little Lua script that searches in configuration files all pathes and replaces the drive letter. Then I run Lazarus with a CMD script. The Lua script and the CMD script are in the main directory of the USB key, since they take the drive letter from their own path. I attach the both scripts. Maybe it will be useful to someone or maybe you will help me to improve them.
On your work and home computer after you plug your usb stick open "control panel" => "admin tools" =>"Computer management" =>"Disk Management" select the usb disk right click and select "change drive letter and paths" (or something along those line ee ad remove letters etc) remove the currently assigned letter and add a letter that will always be available when you plug the stick on I usually choose z: and y:  etc for my external drives. save changes. Now every time you plug that stick on it will take the letter you assign to it if it is available (and they usually are) before trying to auto assigning a letter and you are ready to use it with out any changes between the 2 computers.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Lazarus Portable for Windows
« Reply #9 on: May 23, 2015, 07:33:33 pm »
Don't you need administrative rights for that? The OP does not have these permissions.

nomorelogic

  • Full Member
  • ***
  • Posts: 165
Re: Lazarus Portable for Windows
« Reply #10 on: May 23, 2015, 08:15:02 pm »
another way can be fpcup
you can try with parameter installdir="your USB letter"\lazarus

if you need to change drive letter you can do as previous post suggest or, as alternative, you can change lazarus config parameter settings path inside startup script



taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Lazarus Portable for Windows
« Reply #11 on: May 23, 2015, 08:20:31 pm »
Don't you need administrative rights for that? The OP does not have these permissions.
Its a simple request I see no problem for the admin (if he not able to do it him self) to acommodate him. It was considered one of the standard requests in most of my work places when a computer was set up. The admin would share a list with 10 or 15 items that you had to fill out what you need including special programs you might need in your daily work. In this case since he already has the right to use usb devices asking for a specific letter for hes device its a no brainner. If the IT says no then you hack the station to do it manually.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: Lazarus Portable for Windows
« Reply #12 on: May 23, 2015, 09:01:05 pm »
The OP didn't mention USB per se. So I assume he can still install into the general parts of the HDD. (which in practice IMHO runs faster than USB)


sfeinst

  • Full Member
  • ***
  • Posts: 230
Re: Lazarus Portable for Windows
« Reply #13 on: May 23, 2015, 10:38:52 pm »
OP didn't mention it, but I know some companies allow reading from USB but not writing to it.  So USB might not be an option for some.

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: Lazarus Portable for Windows
« Reply #14 on: June 25, 2015, 07:20:44 am »
If the problem is about user privileges you must change setup adding:

Code: [Select]
PrivilegesRequired=lowest

To current lazarus setup script. No admin privileged required to run the setp.

Then debug it: if you want to make it 'more portable' do this:

- remove all [Registry] code (remove file associations)
- add uninstallable. From inno setup help:

Code: [Select]
Example:
[Setup]
Uninstallable=not IsTaskSelected('portablemode')

[Tasks]
Name: portablemode; Description: "Portable Mode"

- remove Qt since it installs on system.
- add this to install in an accessible folder for unprivileged users, maybe common docs or user app data (the most used)
Code: [Select]
DefaultDirName={commondocs}\{#MyAppName}- remove the icons section and other stuff that do'n want
- changesassociations set to false

The setup need to just extract and set up the config files in a folder accessible for an unprivileged user. Don't touch anything else.

 

TinyPortal © 2005-2018