1 /* coded by Ketmar // Invisible Vector (psyc://ketmar.no-ip.org/~Ketmar)
2 * Understanding is not required. Only obedience.
4 * This program is free software. It comes without any warranty, to
5 * the extent permitted by applicable law. You can redistribute it
6 * and/or modify it under the terms of the Do What The Fuck You Want
7 * To Public License, Version 2, as published by Sam Hocevar. See
8 * http://www.wtfpl.net/txt/copying/ for more details.
10 ////////////////////////////////////////////////////////////////////////////////
11 const PREFS_BRANCH
= "extensions.guerilla.";
14 fsoReadmeViewed
: false, // readme viewed?
19 // all pathes are relative to profile dir
20 jsdir
: "guerillajs/scripts",
21 libdir
: "guerillajs/libs",
22 dbdir
: "guerillajs/data",
23 pkgdir
: "guerillajs/packages",
24 pkgdbdir
: "guerillajs/packages/_0data",
25 pkgtempdir
: "guerillajs/packages/_0temp",
28 const PREFS_DIR_NAMES
= {
34 pkgtempdir
: "PkgTempDir",
38 ////////////////////////////////////////////////////////////////////////////////
39 // restore old values if user has some old dirs
41 const PREFS_OLD_DIRS
= {
43 libdir
: "guerillajs_libs",
44 dbdir
: "guerillajs_data",
45 pkgdir
: "guerillajs_packages",
46 pkgdbdir
: "guerillajs_packages/_0data",
47 pkgtempdir
: "guerillajs_packages/_0temp",
50 const dirSvcProps
= Cc
["@mozilla.org/file/directory_service;1"].getService(Ci
.nsIProperties
);
52 for (let [n
, v
] of Iterator(PREFS_OLD_DIRS
)) {
53 if (n
=== "jsdir" || v
=== "guerillajs") continue;
54 // get profile directory
55 let df
= dirSvcProps
.get("ProfD", Ci
.nsIFile
);
56 if (v
.length
) for (let d
of v
.split("/")) if (d
.length
) df
.append(d
);
58 Cu
.reportError("GS: old directory ('", n
, "' [", v
, "]) found!");
63 // found? restore old values
64 if (oldFound
) for (let [n
, v
] of Iterator(PREFS_OLD_DIRS
)) PREFS
[n
] = v
;