You are here

Environment Variables in NSIS - Getting Rather Stumped

6 posts / 0 new
Last post
Patrick Patience
Offline
Last seen: 4 years 9 months ago
DeveloperModerator
Joined: 2007-02-20 19:26
Environment Variables in NSIS - Getting Rather Stumped

Ok, so I'm trying to set the enviroment variable in NSIS for a program, and this one is from John's aMSN launcher for the UserProfile path. I tried this, and the programs settings are created in the Data folder under "Data\settings\Application Data\AppName"

However, when I try to change the "USERPROFILE" variable to the "APPDATA" variable, which I'm quite sure is also a Windows variable, it won't work? I noticed in say the command prompt launcher, the below is exactly the same, just with the "ComSpec" variable, so I don't understand why the "APPDATA" variable is not working? Can anyone help me out?

UserProfileEnvironment:
;=== Set the %USERPROFILE% directory if we have a path
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("USERPROFILE", "$SETTINGSDIRECTORY").r0'

THIS Won't work...


UserProfileEnvironment:
;=== Set the %USERPROFILE% directory if we have a path
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("APPDATA", "$SETTINGSDIRECTORY").r0'

The section title doesn't matter because it's just a reference for the launcher to go to, and the ;=== is ignored, so I don't understand what's wrong?

Does anyone else? Blum

John T. Haller
John T. Haller's picture
Offline
Last seen: 10 hours 1 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Hit or Miss

APPDATA is hit or miss. Some apps use it, some don't. Even USERPROFILE can be hit or miss. Some apps use it, some pull it from the registry (Sudoku did that before I modified it).

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

Patrick Patience
Offline
Last seen: 4 years 9 months ago
DeveloperModerator
Joined: 2007-02-20 19:26
Oh.

Well that's good to know, saves me more hours of trying to figure it out.

What do you think is better, having "Data\settings\Application Data\ultraMaGe"

Or just copying the settings back and forth? ultraMaGe is just a fairly decent file manager on SF that I wanted to post in beta for the people who want a portable file manager. Thought, I was gonna try and recompile it with nicer icons, so I'll check into that as well.

______________________
Signature...What Signature?

Ryan McCue
Ryan McCue's picture
Offline
Last seen: 15 years 4 days ago
Joined: 2006-01-06 21:27
.

Yoink! *steals ultraMaGe Portable* Mine now! (Kidding :P)

And you should probably just copy/rename. It's guaranteed to work (as long as the program isn't stupid).
----
Ryan McCue.
Blog.
So all that Airbus-delay trouble over here in Europe is because of YOU!
Simeon.

"If you're not part of the solution, you're part of the precipitate."

Patrick Patience
Offline
Last seen: 4 years 9 months ago
DeveloperModerator
Joined: 2007-02-20 19:26
Haha.

Yea, that's what I was thinking. Haha, the only reason I'm going it is because you mentioned it in a past thread. Biggrin

______________________
Signature...What Signature?

Simeon
Simeon's picture
Offline
Last seen: 9 years 11 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
Thanks for the info

John.
I have something in the pipeline which needs the temp variable to be set to the drive so it doesnt fill up the users temp folder and I am thankful for the clarification as I played with the environment variables stuff in NSIS for some time now.
“I can live with doubt and uncertainty and not knowing. I think it is much more interesting to live not knowing than to have answers that might be wrong.” - Richard P. Feynman

"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate

Log in or register to post comments