You are here

PAL Environment variable?

10 posts / 0 new
Last post
joshatt
Offline
Last seen: 3 years 2 months ago
Joined: 2010-11-20 18:23
PAL Environment variable?

Hi,
I'm trying to make this portable app, it's already 99% portable except: it writes config to a special folder.It's like:
D:\PHOTO\MassiGra\user\joshatt\MassiGra.cfg

You see? "joshatt" is my WINXP username. Guess I should use "USERPROFILE", but how could I filter out the "C:\Documents and Settings\" part? And I also have to consider if this portable app is to be used in a win7 or vista computer, it could be filtering out "C:\Users\",instead.

Any idea?

dhiTek
Offline
Last seen: 11 years 1 month ago
Joined: 2012-06-03 01:51
This manuals page about

This manuals page about Environment variable substitions

dansmith65
Offline
Last seen: 3 years 6 months ago
Joined: 2009-04-26 04:18
%USERNAME%

Windows 7 has the %USERNAME% environment variable - that would be ideal to use, but I'm not sure if Win XP also has it.

John T. Haller
John T. Haller's picture
Online
Last seen: 3 min 40 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
It Does

XP does, but I'm not sure about Windows 2000 (which we also support). There are a few sites online listing all the Windows environment variables.

Sometimes, the impossible can become possible, if you're awesome!

Aluísio A. S. G.
Offline
Last seen: 7 years 9 months ago
DeveloperTranslator
Joined: 2010-11-09 17:43
What if...

the user doesn't have a D: drive?

Previously known as kAlug.

joshatt
Offline
Last seen: 3 years 2 months ago
Joined: 2010-11-20 18:23
No, I did not set working

No, I did not set working directory. This software is basically a portable one, except the subdir "joshatt" part.

Ken Herbert
Ken Herbert's picture
Offline
Last seen: 6 hours 19 min ago
DeveloperModerator
Joined: 2010-05-25 18:19
That bit about the working

That bit about the working dir is actually his signature, it is the solution sometimes, and other times (like now) it just confuses people.

As stated above, %USERNAME% is the way to do it. It should do exactly what you want on all OSes supported by PortableApps (Win2k and above).

joshatt
Offline
Last seen: 3 years 2 months ago
Joined: 2010-11-20 18:23
Thank you.I'm following the

Thank you.
I'm following the manual to build this. And another question pops up:
I'm gonna put this "MassiGra.cfg" file to DATA folder of portableapps, and use
[FILEMOVE]
MassiGra.cfg=%PAL:AppDir%\MassiGra\user\%USERNAME%

But, I guess that way the "MassiGra.cfg" will not be updated, it'll keep using this old version every time the process is started. That's not what I want. I want this %USERNAME% folder created, and MassiGra.cfg updated,as well.---- I guess it is: if %USERNAME% folder NOT exists, create it and copy/move MassiGra.cfg to it, if exists, do nothing, thus MassiGra.cfg will be naturally updated.

Aluísio A. S. G.
Offline
Last seen: 7 years 9 months ago
DeveloperTranslator
Joined: 2010-11-09 17:43
Try this
[DirectoriesMove]
UserConfig=%PAL:AppDir%\MassiGra\user\%USERNAME%

This will copy the entire folder back and forth.
Now just create the UserConfig folder in DefaultData and put MassiGra.cfg within it.

Previously known as kAlug.

joshatt
Offline
Last seen: 3 years 2 months ago
Joined: 2010-11-20 18:23
Sorry for the delay, I went

Sorry for the delay, I went out for a trip....
This one works perfect!
Thanks a lot.

Log in or register to post comments