You are here

Is it possible to redirect %USERPROFILE% in launcher.ini?

5 posts / 0 new
Last post
Michael_M
Offline
Last seen: 14 years 1 week ago
Joined: 2010-10-22 04:07
Is it possible to redirect %USERPROFILE% in launcher.ini?

Hi folks,

I just started with portable apps. My goal ist to make an qt-based app portable to run from an USB flash drive. This app uses no registry keys but unfortunately it places somes data in the directory where Windows environment variable "%USERPROFILE% points to.

I read in this forum and tuts about the possibility to create an individual launcher for that app. So I started from scratch, portet the app into the portable apps format and wrote an AppInfo.ini and a launcher.ini. I thougth it would be possible to redirect the Windows environment variables within the launcher.ini. But now I´m not so sure about that...

I tried follwing code in the launcher.ini:

[Environment]
USERPROFILE=%PAL:DataDir%

But that doesn´t work. Portable apps Launcher rans over it and created an .exe to start. With this .exe my app starts fine but still uses the USERPROFILE directory on the host machine.

Is there anything more to do or is it simply not possible to redirect environment variables with a Laucher so that I´m forced to write my own installer?

regards

Michael

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 4 months ago
Joined: 2007-04-15 21:08
Don't redirect

Redirecting USERPROFILE is rarely a safe action; changing it breaks the Windows file picker and other things. In the PortableApps.com Launcher, use [DirectoriesMove] or [FilesMove] to achieve the same result.

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

Michael_M
Offline
Last seen: 14 years 1 week ago
Joined: 2010-10-22 04:07
Thanks 4 help

Hi Chris and thanks 4 help.

Using [DirectoriesMove] solved my problem. I had this tought before but wasn´t sure to manage the directories possibly existing. But the backup function works fine.

regards

Michael

SantoshV
Offline
Last seen: 13 years 11 months ago
Joined: 2010-10-16 17:38
Ditto

Mine uses %APPDATA%.. But when i run in my username,i get all the same settings.. But when i run it under different username the settings are reverted back to the default..

There is no substitute for experience...

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 9 years 4 months ago
Joined: 2007-04-15 21:08
Depends

If a ShGetFolderLocation or similar call is used to find APPDATA (the recommended way) then you can't just change APPDATA without special care, and there are still negative side-effects (I had a script to do it but stopped it after I realised the full implications of it). In that case, just move it.

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

Log in or register to post comments