You are here

Question about appdata path

11 posts / 0 new
Last post
IllusionofDemise
Offline
Last seen: 7 years 11 months ago
Joined: 2007-08-08 08:53
Question about appdata path

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??

Simeon
Simeon's picture
Offline
Last seen: 9 years 6 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
Maybe it uses

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

IllusionofDemise
Offline
Last seen: 7 years 11 months ago
Joined: 2007-08-08 08:53
is there a readme file that

is there a readme file that explains how to use it??

Zach Thibeau
Zach Thibeau's picture
Offline
Last seen: 1 year 6 months ago
Developer
Joined: 2006-05-26 12:08
Well...

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 Biggrin

your friendly neighbourhood moderator Zach Thibeau

rab040ma
Offline
Last seen: 2 weeks 2 days ago
Joined: 2007-08-27 13:35
Appdata

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

Simeon
Simeon's picture
Offline
Last seen: 9 years 6 months ago
DeveloperTranslator
Joined: 2006-09-25 15:15
Nice overview

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

IllusionofDemise
Offline
Last seen: 7 years 11 months ago
Joined: 2007-08-08 08:53
i changed the source of the

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

twoears
Offline
Last seen: 16 years 8 months ago
Joined: 2007-09-05 03:05
Compliments to rab040ma

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.

mstinaff
Offline
Last seen: 14 years 2 months ago
Joined: 2006-10-01 10:58
I am having a similar problem

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

John T. Haller
John T. Haller's picture
Offline
Last seen: 1 hour 47 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Varies

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!

mstinaff
Offline
Last seen: 14 years 2 months ago
Joined: 2006-10-01 10:58
hmm

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

Log in or register to post comments