Hi
I searched about it and also I found A lot of using script for Setting Environmental Variables Temporarily at site ( redirect folder)but I don't know why didn't work with Nsis launcher
also here
http://nsis.sourceforge.net/Setting_Environment_Variables
StrCpy "$SETTINGSDIRECTORY" "$EXEDIR\Data\${DEFAULTSETTINGSDIR}"
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("APPDATA", "$SETTINGSDIRECTORY")
when run Nsis Launcher with this code Portable APP made setting in AppData
folder again (why didn't make Directly in the $SETTINGSDIRECTORY?)
any one can tell what is wrong?
There are (at least) three different ways that an application can query the location of the Application Data folder.
There is the %APPDATA% environment variable, there is a syscall to SHGetSpecialFolderLocation, and there is directly querying the registry.
Beyond that, some apps actually build the path to it based on the username.
Different application use different methods, so without knowing what the application you are trying to portablize is, there is no way of knowing which method it is using, and, therefore, no way to know why it isn't working.
The bad news is that there isn't any way (so far as I know) to redirect the syscall, a registry change is global to the entire machine while your app is running, and if the app is poorly written (builds the path itself) you're even more stuck.
If it is open source, you can look through the code to see what method it uses to determine its data folder, and, if necessary, you could even modify it, and submit patches to the author for consideration to assist with making it more portable.
If it is closed source, you could try contacting the author, but that can have variable success depending on the size of the organisation that wrote it.
it is close source.
I couldn't find any ini file or data from it to help .
need to contact to author.
thank u for your guide to me
Also, redirecting AppData is usually not considered a good idea. Rather, you should just move the files before and after the app is run.
Quamquam omniam nescio, nec nihil scio.
If it can be done just with changing APPDATA - not USERPROFILE as well - then there's nothing wrong with 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
I thought its the best way to do it because it only redirects the variable for the current process and its child processes.
"What about Love?" - "Overrated. Biochemically no different than eating large quantities of chocolate." - Al Pacino in The Devils Advocate
for example, if those child processes include spawning the default browser, then it could try to launch the locally installed firefox pointing it's profile folder to some bizarre place on your flash drive, which is unlikely to be the desired or expected result.
Again, it depends on what you change. If you just change APPDATA, you should be fine. USERPROFILE shouldn't really be changed ever.
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