Log in

View Full Version : PgcEdit 0.6.1: Correct localized Windows environment


frank
17th August 2005, 12:29
PgcEdit prefers as localized folders "Application Data" and "Program Files".
But they don't exist in foreign Windows versions, then Pgcedit stores configuration into the root of user home folder without any warning.

All things are working well until you install any program which creates the english named folders. Then you will lose your whole configuration! PgcEdit now searches in the english named folders. So happen to me.

To solve the problem we must do some debugging in PgcEdit.tcl: proc init_user_prefs
Delete red lines! Insert green lines!

Application Data ine 209
set ::config(config_directory) $::env(HOME)

if {$::tcl_platform(platform) == "windows"} {
if {[file exists [file join $::env(HOME) "Application Data"]]} {
set ::config(config_directory) [file join $::env(HOME) "Application Data/PgcEdit"]
}
# $::env(HOME) is wrong on some foreign Windows systems
if {[info exists ::freewrap::progname] && \
[info script] == "" && ! [file exists [file join $::env(HOME) "Application Data"]]} {
if {! [catch {set tmp [registry get "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" "AppData"]} err_str]} {
set ::config(config_directory) [file join $tmp "PgcEdit"]
}
}
} else {
set ::config(config_directory) [file join $::env(HOME) ".PgcEdit"]
}

Program Files line 249
set progfiles "${rootdir}Program files\\"
if {! [catch {set tmp [registry get "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion" "ProgramFilesDir"]} err_str]} {
set progfiles "$tmp\\"
}
} else {
set ::config(tk) x11
Changes are working well in german version of Win XP and Win98. (Anwendungsdaten, Programme)

r0lZ
17th August 2005, 19:06
OK. I don't understand your fixes without reading the code, but I will see if I can correct that problem. Thanks.

frank
18th August 2005, 09:46
Example:
German Win XP uses "Anwendungsdaten" rather than "Application Data". This localized name is readable from registry.
PgcEdit doesn't find "Application Data" and creates his folder into user home directory.

When you install MS Office (or Cool Edit 2k) it adds "Application Data" folder to the user home directory in German XP version!
Now PgcEdit uses the "Application Data" folder and does not find the old configuration data.

With my update PgcEdit should use the registered (localized) name of that folders.

Simpler way is we only using the user home folder and not "Application Data".

r0lZ
19th August 2005, 09:12
OK, I understand better.

Simpler way is we only using the user home folder and not "Application Data".I don't like this solution. The app data folder is there for this purpose.
Just wondering why his name is localized by Windows, since this folder is normally hidden and unacessible to the normal user. Why don't they translate Windows to Fenêtres (in french)? :angry:

r0lZ
19th August 2005, 12:49
OK. I have modified the code, but a little bit differently than what you suggested.
if {$::tcl_platform(platform) == "windows"} {
set ::config(config_directory) [file join $::env(HOME) "PgcEdit"]
# $::env(HOME) is wrong on some foreign Windows systems
if {! [catch {set tmp [registry get "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" "AppData"]} err_str]} {
set ::config(config_directory) [file join $tmp "PgcEdit"]
} elseif {[file exists [file join $::env(HOME) "Application Data"]]} {
set ::config(config_directory) [file join $::env(HOME) "Application Data/PgcEdit"]
}
} else {
set ::config(config_directory) [file join $::env(HOME) ".PgcEdit"]
}I have made it this way because in some registry, the "registry get" function doesn't work well, and if the "Application Data" folder was already present, the config files are stored in that directory, instead of in the home.
I will add also some code to move the original files from ~/PgcEdit or Application Data/PgcEdit to the correct location, if needed.


For the Program Files folder, I have adopted your solution.