AW: Writing to Win programm files dir?
kray at sonsothunder.com
Fri Jun 29 10:45:02 CDT 2007
On Fri, 29 Jun 2007 16:26:06 +0200, Tiemo Hollmann TB wrote:
> Hi Scott, ok, that's what I thought. And what do you do if the user can save
> data in your app / stack? Do you separate the app without saving feature,
> written to program files and other stacks with saving, writing to app data?
Guys, this has all been covered already... :-)
Here's the basic problem for Vista:
Tip: "Vista 'Gotchas' You Should Know About"
And the suggested approach has been in emails to the list (which I'm
going to turn into another tip so I don't have to hunt it down each
Best would be to create your program with just a "stub" (also
called "splash") executable (that all it does is launch and open
another stack file on disk. This way, you can install your stub program
in the Program Files folder, the rest of the running stack(s) that make
up your program in the user's Application Data folder, and then save
any data that the user generates into the user's Documents folder.
What that translates to on XP and Vista is:
1) Main Executable Stub
Install Location: specialFolderPath(38)
Windows XP - C:\Program Files
Windows Vista - C:\Program Files
2) Additional Program Stacks
Install Location: specialFolderPath(26)
Windows XP - C:\Documents and Settings\Ken\Application Data
Windows Vista - C:\Users\Ken\AppData\Roaming
3) Generated User Documents
Install Location: specialFolderPath(5) [another form is
Windows XP - C:\Documents and Settings\Ken\My Documents
Windows Vista - C:\Users\Ken\Documents
If you don't already have this page bookmarked, I would suggest it:
Tip file010: 'specialFolderPath' Codes
> Where would you put a file that the app itself needs to update,
> regardless of which user is running it? I've been putting that file
> into an "all users/application data/myapp/" folder but if there are
> permissions problems with that, what then?
Well, there's the rub - there isn't a simple answer. The problem is
that for truly "locked down" users, the application itself would need
to elevate its permissions to take actions that the currently logged-in
user's permissions do not allow. OS X we can do with "sudo" and get
authorization; Trevor just found a way to ask for authorization under
Vista, but for other Windows flavors there isn't a solution for
Revolution that's been made known.
What I've ended up needing to do is to request that Windows users get
added to the "Power Users" group, which gives them some form of
elevated access, but doesn't quite make them "Administrators". However
some companies won't even allow that...
So the bottom line is that until we have an "All Users" solution in
place for all platforms, best is to either install for a single user or
to get someone with Admin privileges to install for All Users (they may
have to authenticate or acknowlege a security dialog in Vista if the
User Account Control is turned on).
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
More information about the use-livecode