You are here

Suggestion for Portable Command-line Tools: %Path% Portable

9 posts / 0 new
Last post
JCSalomon
Offline
Last seen: 2 years 11 months ago
Joined: 2007-09-25 17:40
Suggestion for Portable Command-line Tools: %Path% Portable

I just saw the posting for Mercurial Portable dev test, and something occurred to me.

There are many command-line tools that could well be Portable-ized, mostly development tools like MinGW, Perl, TeX, Mercurial, etc. We could go down the route of customizing the %Path% for Command Prompt Portable but interoperability between programs will be limited. You can set up commandprompt.bat so that, e.g., Mercurial and TeX are both in the %Path%, but that won’t hold if you’re using Notepad++ with a (hypothetical) Mercurial plug-in. So…

I’d like to suggest that some of the functionality of commandprompt.bat be rolled in to the PortableApps.com platform. Specifically, I'd like the ability to set environment variables like %Path% in some file so they hold for all programs launched from the platform.

Does anyone else think this a good idea?

vf2nsr
vf2nsr's picture
Offline
Last seen: 7 years 5 months ago
Developer
Joined: 2010-02-13 17:10
Interesting

MiniGW already ahs been portablalized with the command prompt feature as you discussed

“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” Dr. Seuss

Mark Sikkema
Offline
Last seen: 12 years 6 months ago
Developer
Joined: 2009-07-20 14:55
An idea...

Luckily enough a usb-drive, containing PortableApps.com platform, has a dummy file sitting in the root of the drive called 'StartPortableApps.exe'.

If we would just change this executable for something what reads the Paths from an ini file and adds these additional paths to the environment variable before executing the platform (X:\PortableApps\PortableApps.com\PortableAppsPlatform.exe), I think we produce what you are talking about.

Here is an example

Formerly Gringoloco
Windows XP Pro sp3 x32

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
Planning on doing it

This is pretty much what I've suggested and mentioned a few times. I'm planning on doing it with a common Data directory though, such that applications would register themselves in CommonFiles\Data\CommandPrompt.pth, a file like this:

MercurialPortable\App\Mercurial
MinGWPortable\App\MinGW\bin
AppNamePortable\App\AppName

At a later point this could be integrated with the uninstall feature of the PortableApps.com Platform; other common data options could also be added to the PortableApps.com Format so that common data can be removed in uninstalling when the last application using it is removed. And if orphaned sections do get left behind in this file they just won't be added to the PATH.

Now that I've come up with a distinct format I can work on putting code to handle it in Command Prompt Portable. It's pretty straight forward.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

JCSalomon
Offline
Last seen: 2 years 11 months ago
Joined: 2007-09-25 17:40
But it’s not just %Path%

Some programs (especially UNIX ports) like to have other environment variables (i.e., not just %Path%) set certain ways. I’m not sure if the latest version of TeX Live still requires them, but past versions make good examples of this: there was %TEXMFVAR% and %TEXMFHOME% and ….

Also consider a (Portable) compiler process launched from a Notepad++ Portable session: will it also have the environment correctly set? (This is the reason I’m suggesting to incorporate environment handling in the PAP.)

(ETA: On the other hand, tweaking Command Prompt portable is at least a good proof-of-concept, and will be useful even before the feature might be added to the PAP. Just please don’t limit it to %Path%.)

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
Hadn't thought of that

I hadn't thought of all that. I think I'll need to revise my format.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

JCSalomon
Offline
Last seen: 2 years 11 months ago
Joined: 2007-09-25 17:40
As for Command Prompt Portable…

Command Prompt Portable has a place for a batch file to be run every time the program loads; this would be the place to set %Path% & %TEXMFVAR% & …. I just realized that my suggestion of %Path% Portable is pretty much only useful if it’s integrated into the PAP.

Ioan Brinzas
Offline
Last seen: 13 years 5 months ago
Joined: 2010-06-26 13:03
StartPortableApps.bat

When I've had the same problem I've developed a less elegant but workable solution: I've create a StartPortableApps.bat file, in the same folder as StartPortableApps.exe, and launch the batch file instead of the .exe; its current content is:

@echo off
set PORTABLE_APPS_PATH=%~dp0PortableApps
%~dp0_StartPortableApps.exe

(I've renamed the .exe, with an underscore in front, just to avoid it being launched accidentally when typing 'StartPortableApps', without extension, on command line)

This way I could add whatever environment variables I want, and they are visible in all PortableApps programs launched.

JCSalomon
Offline
Last seen: 2 years 11 months ago
Joined: 2007-09-25 17:40
Clever!

That’s kinda clever! I like it.

Log in or register to post comments