Portable Komodo

Posted by hebetude on 2007-09-10 10:34
Forums: Komodo support | OS: Windows XP Pro

Has there been any work in the way of making Komodo Portable? Could I hack up the software so it can be run from a portable flash drive?

toddw
ActiveState Staff
Mon, 2007-09-10 11:29

There is still the major blocker for this in that parts of the Komodo profile reside in a directory that is named after the computer hostname (which could be different for every machine you run upon).

Reference:
http://aspn.activestate.com/ASPN/Mail/Message/komodo-discuss/3515928

hebetude | Mon, 2007-09-10 13:24

I'm only going to be using this on one PC. So, if I just copy this folder I'm gravy?

toddw
ActiveState Staff
Mon, 2007-09-10 14:34

In that case, you can install Komodo on the PC normally (or even install to the flash drive) and then just use the KOMODO_USERDATADIR environment variable to set where all the preferences are stored. Example:

set KOMODO_USERDATADIR=F:\komodo_profiles

Note: The environment variable must be set before Komodo is run (either through the command prompt or in the Windows system prefs).

For reference, here are the details for the Komodo profile settings:
http://community.activestate.com/faq/komodo-file-locations

Cheers,
Todd

hebetude | Wed, 2007-09-12 15:34

So, I have to ask. I came home tried this out, and komodo is trying to Pre-load the Code Intelligence Database. Is there another folder of settings I need to copy over?

toddw
ActiveState Staff
Wed, 2007-09-12 10:45

You can also set this up in a bat file, example "E:\runPortableKomodo.bat", which contains:

set KOMODO_USERDATADIR=F:\komodo_profiles\KomodoEdit
"C:\Program Files\ActiveState Komodo Edit 4.1\komodo.exe"

Note: You may have to customize the executable path.

Then when you double click/launch this "runPortableKomodo.bat" file, it will start Komodo with the custom user data profile directory.

Cheers,
Todd

hebetude | Wed, 2007-09-12 11:21

Batch file is a great idea! I'm not to familiar with how environment variables work, but this would create a temporary setting, right?

So, it would have to be redone every time the [cmd.exe is restarted|computer is restarted]. Also, can this be done on windows computers with non-admin privileges?

toddw
ActiveState Staff
Wed, 2007-09-12 12:17

This batch file provides a non-admin priveledged way of changing the environment variable that only affects the running of the Komodo application. The trick is though, everytime you want to startup Komodo, you have to launch it using this batch file.

Cheers,
Todd

hebetude | Wed, 2007-09-12 15:30

Okay, I may finally have it hashed out. Here's my new batch file:
My directory structure on the flash drive is:

Applicaton Data/ActiveState/KomodoEdit/4.2 (local settings)
&&
ActiveState Komodo Edit 4.2/ (program)

It finds the Drive Letter the batch file (which can be in any location on the same drive) is on and then it checks to see if the local folder is in the correct spot, if it's not it moves the folder to what Komodo expects "host-%computername%". If there are multiple host-___ folders this won't work (I'm not sure why there would be though).

@echo off
cd \
set KOMODO_USERDATADIR=%CD%Application Data\ActiveState\KomodoEdit
set KOMODO_HOSTDATADIR=%KOMODO_USERDATADIR%\4.2
IF NOT EXIST "%KOMODO_HOSTDATADIR%\host-%computername%\NUL" move "%KOMODO_HOSTDATADIR%\host-*" "%KOMODO_HOSTDATADIR%\host-%computername%"
"%CD%ActiveState Komodo Edit 4.2\komodo.exe"

toddw
ActiveState Staff
Wed, 2007-09-12 15:39

The renaming of the "host-" directory is a neat idea and I believe it should work.

The codeintel database preload step only occurs in either of these two times:

  • there was no existing code intelligence data (i.e. there was no profile folder)
  • the profile contains older code intelligence data (your now using a newer Komodo version)

Todd.

hebetude | Wed, 2007-09-12 16:09

I was using a test directory, it works just fine with real data :). This is a little more efficient in characters

REM @echo off
cd \
set KOMODO_USERDATADIR=%CD%Application Data\ActiveState\KomodoEdit
IF NOT EXIST "%KOMODO_USERDATADIR%\4.2\host-%computername%\NUL" move "%KOMODO_USERDATADIR%\4.2\host-*" "%KOMODO_USERDATADIR%\4.2\host-%computername%"

"%CD%ActiveState Komodo Edit 4.2\komodo.exe"

It spits out an error if the IF NOT EXIST fails, don't know why... but the command window closes so fast it doesn't matter.