summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-04-09 17:18:26 -0400
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-04-09 17:18:26 -0400
commit72516850b238afa13a54c4e584710e22d873179a (patch)
tree1b34b18d4f85792083f2ad491bc13dea88b1b3a3
parent3944db9c147ec19120b3d1f0ff360a46e48eb8ca (diff)
fixed bug #1 (platform-specific)
we're using os.path.expanduser instead of os.getenv('HOME'). modified: combox/cbox.py modified: combox/config.py
-rw-r--r--combox/cbox.py3
-rw-r--r--combox/config.py10
2 files changed, 8 insertions, 5 deletions
diff --git a/combox/cbox.py b/combox/cbox.py
index add5883..f49ca3f 100644
--- a/combox/cbox.py
+++ b/combox/cbox.py
@@ -24,6 +24,7 @@ import yaml
from argparse import ArgumentParser
from os import path
+from os.path import expanduser
from sys import exit
from threading import Lock
from watchdog.observers import Observer
@@ -67,7 +68,7 @@ def main():
if args.test:
CONFIG_DIR = path.join('tests', 'test-config')
else:
- CONFIG_DIR = path.join(os.getenv('HOME'),'.combox/')
+ CONFIG_DIR = path.join(expanduser("~"),'.combox')
config_file = path.join(CONFIG_DIR, 'config.yaml')
diff --git a/combox/config.py b/combox/config.py
index ea6acd4..af86b90 100644
--- a/combox/config.py
+++ b/combox/config.py
@@ -1,3 +1,4 @@
+
# Copyright (C) 2015 Combox author(s). See AUTHORS.
#
# This file is part of Combox.
@@ -48,6 +49,7 @@ import sys
import stat
from os import path
+from os.path import expanduser
def get_secret():
"Gets the pass phrase from std. input."
@@ -62,7 +64,7 @@ def get_stdin(prompt):
return raw_input(prompt)
-def config_cb(config_dir = path.join(os.getenv('HOME'),'.combox/'),
+def config_cb(config_dir = path.join(expanduser("~"), '.combox'),
pass_func = get_secret,
input_func = get_stdin,
write=True):
@@ -77,10 +79,10 @@ def config_cb(config_dir = path.join(os.getenv('HOME'),'.combox/'),
config_info = {}
config_info['combox_name'] = input_func('name of this combox')
- config_info['combox_dir'] = path.abspath(input_func('path to combox directory'))
+ config_info['combox_dir'] = path.abspath(expanduser(input_func('path to combox directory')))
silo_help_txt = 'silo directory (default: %s)' % (config_dir)
- silo_dir = input_func(silo_help_txt)
+ silo_dir = expanduser(input_func(silo_help_txt))
if silo_dir:
config_info['silo_dir'] = path.abspath(silo_dir)
@@ -94,7 +96,7 @@ def config_cb(config_dir = path.join(os.getenv('HOME'),'.combox/'),
for i in range(no_nodes):
node_name = input_func('node %d name' % i)
nodes[node_name] = {}
- nodes[node_name]['path'] = path.abspath(input_func('node %d path' % i))
+ nodes[node_name]['path'] = path.abspath(expanduser(input_func('node %d path' % i)))
nodes[node_name]['size'] = input_func('node %d size (in mega bytes)' % i)
nodes[node_name]['available'] = nodes[node_name]['size']