How to handle dependency files in a cross-platform manner?
I'm working on updating an old app. It has some dependency files that live in the same directory as the app. Obviously this broke when Windows Vista came out (since it violates the API and Vista/7 now enforce that (XP didn't)).
Ideally, I'd like to avoid hardcoding anything into the app for just Windows. I c开发者_如何学运维an live with that if I have to though. I've already been down that path with pulling the APPDATA and LOCALAPPDATA environment variables, but that doesn't help any since they just give you the current user area... I need these to live somewhere accessible for all users, and I'd like to obey the Windows API expectations that they go into the all user appdata area.
Suggestions?
If you really mean cross platform and not just Vista compliant, the correct way is the Preferences API. Last time I tried that on Vista though, the system store didn't work, though.
If you just mean Vista, you can get the system environment variables and reference it that way.
I think I may have a Windows specific location... I was confused at first because it's a hidden directory, but the "ALLUSERSPROFILE" environment variable seems to be the right location on Windows.
Still looking for something truly cross-platform if anyone knows of a way.
精彩评论