find profile and prefs.js reliably on win32

This commit is contained in:
jrgm%netscape.com 2002-03-29 04:25:12 +00:00
Родитель 0bd9ddf1cf
Коммит adb6be7f02
1 изменённых файлов: 13 добавлений и 6 удалений

Просмотреть файл

@ -20,9 +20,10 @@ use Cwd;
use File::Basename; # for basename(); use File::Basename; # for basename();
use File::Path; # for rmtree(); use File::Path; # for rmtree();
use Config; # for $Config{sig_name} and $Config{sig_num} use Config; # for $Config{sig_name} and $Config{sig_num}
use File::Find ();
$::UtilsVersion = '$Revision: 1.152 $ '; $::UtilsVersion = '$Revision: 1.153 $ ';
package TinderUtils; package TinderUtils;
@ -889,14 +890,20 @@ sub run_all_tests {
my $pref_file = "prefs.js"; my $pref_file = "prefs.js";
my $moz_profile_dir = "$build_dir/.mozilla"; my $moz_profile_dir = "$build_dir/.mozilla";
if ($Settings::OS =~ /^WIN/) { if ($Settings::OS =~ /^WIN/) {
$moz_profile_dir = "$ENV{APPDATA}" . "\\Mozilla\\Profiles\\$Settings::MozProfileName"; my $is9x = eval 'use Win32; return Win32::IsWin95();';
if ($is9x) {
# works on win98 and win2k. (Different on Me, XP, NT??)
$moz_profile_dir = $ENV{winbootdir} || $ENV{windir} || "C:\\WINDOWS";
$moz_profile_dir .= "\\Application Data";
} else {
$moz_profile_dir = $ENV{APPDATA};
}
$moz_profile_dir .= "\\Mozilla\\Profiles\\$Settings::MozProfileName";
$moz_profile_dir =~ s|\\|/|g; $moz_profile_dir =~ s|\\|/|g;
print "moz_profile_dir: $moz_profile_dir\n"; print "moz_profile_dir: $moz_profile_dir\n";
} }
open PREFS, "find '$moz_profile_dir' -name prefs.js|" my $sub = sub { $pref_file eq $_ and $pref_file = $File::Find::name; };
or die "couldn't find prefs file\n"; File::Find::find($sub, $moz_profile_dir);
$pref_file = $_ while <PREFS>;
chomp $pref_file;
# Find profile_dir while we're at it. # Find profile_dir while we're at it.
my $profile_dir = $pref_file; my $profile_dir = $pref_file;