mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
Let's not change things up on the user. When specifying the directories they
want, we should remember how they typed in the directory.
This commit is contained in:
parent
9db07346dc
commit
e5bea55343
@ -118,6 +118,7 @@ def getDirectoryName(default, basedir=os.curdir):
|
|||||||
while not done:
|
while not done:
|
||||||
dir = something('What directory do you want to use?',
|
dir = something('What directory do you want to use?',
|
||||||
default=os.path.join(basedir, default))
|
default=os.path.join(basedir, default))
|
||||||
|
orig_dir = dir
|
||||||
dir = os.path.expanduser(dir)
|
dir = os.path.expanduser(dir)
|
||||||
dir = _windowsVarRe.sub(r'$\1', dir)
|
dir = _windowsVarRe.sub(r'$\1', dir)
|
||||||
dir = os.path.expandvars(dir)
|
dir = os.path.expandvars(dir)
|
||||||
@ -132,7 +133,7 @@ def getDirectoryName(default, basedir=os.curdir):
|
|||||||
have to pick someplace else.""" % e)
|
have to pick someplace else.""" % e)
|
||||||
else:
|
else:
|
||||||
done = True
|
done = True
|
||||||
return os.path.expandvars(os.path.expanduser(dir))
|
return (dir, orig_dir)
|
||||||
|
|
||||||
def getRegistryValue(setting, prompt='', showHelp=True, showType=True):
|
def getRegistryValue(setting, prompt='', showHelp=True, showType=True):
|
||||||
if not prompt:
|
if not prompt:
|
||||||
@ -231,11 +232,11 @@ def main():
|
|||||||
try:
|
try:
|
||||||
logDir = registry._cache['supybot.directories.log']
|
logDir = registry._cache['supybot.directories.log']
|
||||||
logDir = utils.safeEval(logDir)
|
logDir = utils.safeEval(logDir)
|
||||||
logDir = getDirectoryName(logDir)
|
(logDir, baseDir) = getDirectoryName(logDir)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
logDir = getDirectoryName('logs')
|
(logDir, basedir) = getDirectoryName('logs')
|
||||||
conf.supybot.directories.log.setValue(logDir)
|
conf.supybot.directories.log.setValue(logDir)
|
||||||
basedir = os.path.dirname(logDir)
|
basedir = os.path.dirname(basedir)
|
||||||
|
|
||||||
# conf.supybot.directories.data
|
# conf.supybot.directories.data
|
||||||
output("""Your bot will need to put various data somewhere. Things like
|
output("""Your bot will need to put various data somewhere. Things like
|
||||||
@ -245,9 +246,9 @@ def main():
|
|||||||
try:
|
try:
|
||||||
dataDir = registry._cache['supybot.directories.data']
|
dataDir = registry._cache['supybot.directories.data']
|
||||||
dataDir = utils.safeEval(dataDir)
|
dataDir = utils.safeEval(dataDir)
|
||||||
dataDir = getDirectoryName(dataDir, basedir=basedir)
|
(dataDir, basedir) = getDirectoryName(dataDir, basedir=basedir)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
dataDir = getDirectoryName('data', basedir=basedir)
|
(dataDir, basedir) = getDirectoryName('data', basedir=basedir)
|
||||||
conf.supybot.directories.data.setValue(dataDir)
|
conf.supybot.directories.data.setValue(dataDir)
|
||||||
|
|
||||||
# conf.supybot.directories.conf
|
# conf.supybot.directories.conf
|
||||||
@ -258,9 +259,9 @@ def main():
|
|||||||
try:
|
try:
|
||||||
confDir = registry._cache['supybot.directories.conf']
|
confDir = registry._cache['supybot.directories.conf']
|
||||||
confDir = utils.safeEval(confDir)
|
confDir = utils.safeEval(confDir)
|
||||||
confDir = getDirectoryName(confDir, basedir=basedir)
|
(confDir, _) = getDirectoryName(confDir, basedir=basedir)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
confDir = getDirectoryName('conf', basedir=basedir)
|
(confDir, _) = getDirectoryName('conf', basedir=basedir)
|
||||||
conf.supybot.directories.conf.setValue(confDir)
|
conf.supybot.directories.conf.setValue(confDir)
|
||||||
|
|
||||||
# pluginDirs
|
# pluginDirs
|
||||||
|
Loading…
Reference in New Issue
Block a user