1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 11:18:00 +01:00

Added LIBERATOR_HOME so that users don't have to define lots of environment _HOMEs as the liberator project grows.

This commit is contained in:
Ted Pavlic
2008-12-12 07:42:19 -05:00
parent d182429dd3
commit 47496af2e0

View File

@@ -409,14 +409,25 @@ function IO() //{{{
if (WINDOWS)
path = path.replace("/", "\\", "g");
// expand "~" to VIMPERATOR_HOME or HOME (USERPROFILE or HOMEDRIVE\HOMEPATH on Windows if HOME is not set)
/* expand "~" to
* LIBERATOR_HOME or
* (VIMPERATOR|MUTTATOR)_HOME or (depending on config.name)
* HOME (USERPROFILE or HOMEDRIVE\HOMEPATH on Windows if HOME is not set)
* in that order */
if (/^~/.test(path))
{
let home = environmentService.get(config.name.toUpperCase() + "_HOME");
// First try LIBERATOR_HOME
let home = environmentService.get("LIBERATOR_HOME");
// If no LIBERATOR_HOME, then try (VIMPERATOR|MUTTATOR)_HOME
if (!home)
home = environmentService.get(config.name.toUpperCase() + "_HOME");
// If no (VIMPERATOR|MUTTATOR)_HOME, try HOME
if (!home)
home = environmentService.get("HOME");
// On Windows, stretch even farther for other options
if (WINDOWS && !home)
home = environmentService.get("USERPROFILE") ||
environmentService.get("HOMEDRIVE") + environmentService.get("HOMEPATH");