From 47496af2e01c881dbaea84bebd1c48ea5dc1da3c Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Fri, 12 Dec 2008 07:42:19 -0500 Subject: [PATCH] Added LIBERATOR_HOME so that users don't have to define lots of environment _HOMEs as the liberator project grows. --- common/content/io.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/common/content/io.js b/common/content/io.js index a28d52b0..998846b4 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -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");