im porting a linux program to windows and within the source i have everything set to save all data to a subfolder off the main app dir but for some reason all the appdata is being sent to \Documents and Settings\Username\Application Data\foldername
is this something windows does or am i missing something in the source??
the %APPDATA% variable.
“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
is there a readme file that explains how to use it??
Do a search on windows api and it should help you out there
-----------------------------
"I don't fear Computers. I fear the lack of them" Isaac Asimov
My Personal Blog in the making at a new address thibeaz.com
your friendly neighbourhood moderator Zach Thibeau
When Windows was new, applications sent all their data to their own directory, or to the Windows directory. It soon became clear that this wasn't a good thing -- if two or more people used the computer, their settings got intermingled, for one thing. For another, anyone who could save data in the app or windows directory could mess with executables and other important files. Viruses and adware and other malware soon did.
So for the past 8 or 10 years they've been trying to get programs to write to "Documents and settings\Username\" -- also known as the profile -- which corresponds to the user's home directory under Linux.
PortableApps takes the trend back -- we're not so concerned about multiple users or security, since it is our USB drive we're writing to. But it's been so hard to get regular programs to use the profile (in Windows history) that it can be hard to get them to stop, or to let them know that the profile is now on the USB.
There's most likely an environment setting that the program is honoring -- either an environment variable, such as might be found in Linux, like %APPDATA%, or a setting in the Registry. It sounds like you've changed what you think are the likely ones, so you may need to research the unlikely ones.
One possibility is to get the Sysinternals Resource Monitor and watch what the program is doing -- which registry entries it reads, etc. That might give you some clues. Your launcher could also change the various environment variables for the program it launches, to see if any of them make a difference.
It may just be that the program was hard wired to "do the right thing" (in Windows terms) to use the user profile, and nothing you can do will get it to change its mind. That's the case with several of the programs on this site. What the launchers generally do is is make room for whatever the program is going to write before launching, then copy the data files back to the USB drive and clean up when it is done (put things back the way they were).
On the other hand, if it is a Linux program, it may be open source, in which case you could recompile it to do the PortableApps thing. Might be messy...
MC
Thanks for that.
“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
i changed the source of the program already to write to the exe dir but its still going to the profile dir for some reason so i guess i missed something in the source. ill have to goe through it again i guess
I do not wish to hi-jack this thread but would like to add a brief comment
Having read your post dated September 4 2007 I felt moved to congratulate you for the quality of your response. It is well written, lucid, comprehensible, pertinent, and informative. This is an excellent forum and one which I am confident will continue to improve. One way in which this might be achieved is to use your feedback as a model for future posts.
Win PT references $APPDATA a few times. I may dust off my C and submit a portability patch, but until then I've tried adding this line to the WinPT Portable laucher
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("APPDATA", "$SETTINGSDIRECTORY").r0'
But WinPT is still stubbornly using the \Documents and Settings\Username\ApplicationData path.
using process explorer I can verify that the APPDATA environment variable is being set properly. is that where CSIDL_APPDATA get its value from?
Key ID: 0xDAE3095F
Fingerprint: 5D98 65D2 1844 21A5 76C1 F0F6 4BE6 D689 DAE3 095F
Some programs use '%USERPROFILE%\Application Data' hard coded within them. Other directly read 'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ Shell Folders\AppData' from the registry. Very few seem to use the APPDATA environment variable.
Sometimes, the impossible can become possible, if you're awesome!
Well CSIDL_APPDATA (which is what the Win PT source code uses) doesn't seem tied to environment variables and actually will cause Win PT to have a bug on Vista. It's looking more and more like the best way to go is submitting a Win PT patch.
Key ID: 0xDAE3095F
Fingerprint: 5D98 65D2 1844 21A5 76C1 F0F6 4BE6 D689 DAE3 095F