New PortableApps.com Platform 12.0.5. Better, stronger, faster. Download or Buy on Drive
Instant access to over 300 free and legal portable apps including the new Caesium (Oct 10, 2014)
PortableApps.com needs your help: Please donate today

Local Settings Environment Variable??

Nathan9222's picture
Nathan9222
Developer
- March 7, 2008 - 11:37pm
Share on Facebook

My question is this, i am making an app portable that leaves its appdata in the
C:\Documents and Settings\****\local settings\application data folder, now when i try to get this to save in my data folder it always puts it in the C:\ instead of where i want it to go. What would i change in this part of my script:

!if "${REDIRECTUSERPROFILE}" = "TRUE"
		IfFileExists "$DATADIR\UserProfile\*.*" +2
			CreateDirectory "$DATADIR\UserProfile" ; create directory for portable user profile
		System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("USERPROFILE", "$DATADIR\UserProfile").r0' ; set new user profile folder
		StrCmp "$0" "0" ProfileError
			Goto ProfileDone
		ProfileError:
			MessageBox MB_ICONEXCLAMATION|MB_OK "Can't set environment variable for new Userprofile!$\nLauncher will be terminated."
			Abort
		ProfileDone:
	!endif

Oh yeah the environment variable for local settings is this i think "%userprofile%\local settings\application data" is there another one? and how would i add this to my script to get it to save in my "data" folder?
[Fixed your post up - Ryan]


( categories: )

What's the full path of

What's the full path of where your files end up? In the root of C:\ or some subfolder?

It ends up in a folder...

it ends up in a folder in the C:\Ares, instead of it being put in my "data\ares" folder.

An eye for an eye makes the whole world blind.
Mahatma Gandhi,
Indian political and spiritual leader (1869 - 1948)

Not sure. It sounds like

Not sure. It sounds like it's checking for the existence of %userprofile%\Application Data\ or %userprofile%\Local Settings\Application Data\, and if it doesn't exist it's defaulting to C:\Ares.

Try creating $DATADIR\UserProfile\Application Data\ or $DATADIR\UserProfile\Local Settings\Application Data\

Alright ill try those and tell u how it goes

ill try those in a bit and tell u if they work.

An eye for an eye makes the whole world blind.
Mahatma Gandhi,
Indian political and spiritual leader (1869 - 1948)

Nope they didnt work

I dont know but everything i try doesnt work. Im gonna check my script and make sure i didnt make an error or something.

An eye for an eye makes the whole world blind.
Mahatma Gandhi,
Indian political and spiritual leader (1869 - 1948)