Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Vista and prefs files

3 views
Skip to first unread message

mat...@gmail.com

unread,
Feb 16, 2007, 2:12:03 AM2/16/07
to
My Coccinella users now start migrating to Windows Vista and I receive
the first bug reports. I'm saving the prefs file using the following
algorithm:
foreach key {USERPROFILE APPDATA HOME HOMEPATH \
ALLUSERSPROFILE CommonProgramFiles HOMEDRIVE} {
if {[info exists ::env($key)] && [file writable $::env($key)]} {
set winPrefsDir $::env($key)
break
}
}
which seems to fail on Vista, probably due to the enhanced "security".
Questions: where can I reliably store a standard prefs file (Tcl
option database) on Vista, and does there exist a tool that can use
the windows registry instead of a tcl db file in a transparent way?

Thanks, Mats

fan...@telefonica.net

unread,
Feb 16, 2007, 5:52:34 AM2/16/07
to

mat...@gmail.com ha escrito:

> where can I reliably store a standard prefs file (Tcl
> option database) on Vista, and does there exist a tool that can use
> the windows registry instead of a tcl db file in a transparent way?

So far I have been doing:

set shellFoldersKey \
{HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
Explorer\User Shell Folders}
set appData [registry get $shellFoldersKey AppData]

I only got to run the program once in Vista RC2 but it didn't complain
and, so far, I haven't got any bug reports about it.

Andres

mat...@gmail.com

unread,
Feb 16, 2007, 10:05:35 AM2/16/07
to
On Feb 16, 11:52 am, fan...@telefonica.net wrote:
> So far I have been doing:
>
> set shellFoldersKey \
> {HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
> Explorer\User Shell Folders}
> set appData [registry get $shellFoldersKey AppData]
>
> I only got to run the program once in Vista RC2 but it didn't complain
> and, so far, I haven't got any bug reports about it.
>

But I need a place to store the complete prefs file in a well defined
place, or alternatively, code to set & get a complete file
transparently with Tk option database syntax. I haven't seen any code
that does this. Shouldn't be that difficult to make, but better to get
some tested code.

/Mats


Gerald W. Lester

unread,
Feb 16, 2007, 11:43:28 AM2/16/07
to

Well, you could store it in the registry.

--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+

Darren New

unread,
Feb 16, 2007, 11:52:14 AM2/16/07
to
mat...@gmail.com wrote:
> On Feb 16, 11:52 am, fan...@telefonica.net wrote:
>> So far I have been doing:
>>
>> set shellFoldersKey \
>> {HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
>> Explorer\User Shell Folders}
>> set appData [registry get $shellFoldersKey AppData]
>>
>> I only got to run the program once in Vista RC2 but it didn't complain
>> and, so far, I haven't got any bug reports about it.
>>
>
> But I need a place to store the complete prefs file in a well defined
> place,

The $appData directory shown in the above code is where all applications
store their data. Create a subdirectory there for your application, and
put the file in it.

(There's actually an API call to get this information without groping
the registry, in case future versions of Windows store that info
elsewhere, but groping the registry is built into Tcl already. Also as
an aside, this is often something like C:\Documents and
Settings\Frank\Application Data. Take a look.)

I'm not sure what is the problem you have that isn't solved by this?

--
Darren New / San Diego, CA, USA (PST)
New horror show, now only in Las Vegas:
HANNIBAL LUXOR!

mat...@gmail.com

unread,
Feb 17, 2007, 2:54:42 AM2/17/07
to
On Feb 16, 5:52 pm, Darren New <d...@san.rr.com> wrote:

> mats...@gmail.com wrote:
> > On Feb 16, 11:52 am, fan...@telefonica.net wrote:
> >> So far I have been doing:
>
> >> set shellFoldersKey \
> >> {HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
> >> Explorer\User Shell Folders}
> >> set appData [registry get $shellFoldersKey AppData]
>
> >> I only got to run the program once in Vista RC2 but it didn't complain
> >> and, so far, I haven't got any bug reports about it.
>
> > But I need a place to store the complete prefs file in a well defined
> > place,
>
> The $appData directory shown in the above code is where all applications
> store their data. Create a subdirectory there for your application, and
> put the file in it.
>

I didn't know that you could complete files in the registry.
Thanks for this tip. Will test it.

/Mats

Darren New

unread,
Feb 17, 2007, 12:42:40 PM2/17/07
to

I wasn't suggesting you put complete files in the registry. The
suggestion here is to look up in the registry where you should be
storing your files.

If you don't put them in the right place, bad things start to happen
when you get into more sophisticated situations. Either your
configuration overwrites someone else's, or when you log into a
different machine with the same account, your configuration doesn't
follow along.

walto...@gmail.com

unread,
Feb 19, 2007, 8:33:19 AM2/19/07
to

One of my users sent in a screenshot of an error message they get on
Vista. The program in question is attempting to copy .dll's and
generate prefs files into the current working directory, but it's
throwing a "permission denied" error. I'm going to install Vista and
hopefully find a simple solution. I'll let you know if I find out
anything useful.

Darren New

unread,
Feb 19, 2007, 12:15:10 PM2/19/07
to
walto...@gmail.com wrote:
> One of my users sent in a screenshot of an error message they get on
> Vista. The program in question is attempting to copy .dll's and
> generate prefs files into the current working directory, but it's
> throwing a "permission denied" error.

If the current working directory is under \Program Files, then that's
pretty much to be expected. Unless you have administrative permissions
(or, under Vista, maybe not even then), you can't just randomly write to
directories.

What's the CWD at that point in the program?

0 new messages