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?
This manuals page about Environment variable substitions
Windows 7 has the %USERNAME% environment variable - that would be ideal to use, but I'm not sure if Win XP also has it.
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!
the user doesn't have a D: drive?
Previously known as kAlug.
No, I did not set working directory. This software is basically a portable one, except the subdir "joshatt" part.
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).
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.
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.
Sorry for the delay, I went out for a trip....
This one works perfect!
Thanks a lot.