提交 ab0d33bb 编写于 作者: B BinLong

fix path join bugs

上级 5ddd3a65
...@@ -37,7 +37,7 @@ CACHE_TIME = 60 * 10 ...@@ -37,7 +37,7 @@ CACHE_TIME = 60 * 10
class HubServer(object): class HubServer(object):
def __init__(self, config_file_path=None): def __init__(self, config_file_path=None):
if not config_file_path: if not config_file_path:
config_file_path = hub.CONF_HOME + '/config.json' config_file_path = os.path.join(hub.CONF_HOME, 'config.json')
if not os.path.exists(hub.CONF_HOME): if not os.path.exists(hub.CONF_HOME):
utils.mkdir(hub.CONF_HOME) utils.mkdir(hub.CONF_HOME)
if not os.path.exists(config_file_path): if not os.path.exists(config_file_path):
...@@ -195,7 +195,8 @@ class HubServer(object): ...@@ -195,7 +195,8 @@ class HubServer(object):
try: try:
r = requests.get(self.server_url + '/' + 'search') r = requests.get(self.server_url + '/' + 'search')
data = json.loads(r.text) data = json.loads(r.text)
with open(hub.CACHE_HOME + '/' + RESOURCE_LIST_FILE, 'w+') as fp: cache_path = os.path.join(hub.CACHE_HOME, RESOURCE_LIST_FILE)
with open(cache_path, 'w+') as fp:
yaml.safe_dump({'resource_list' : data['data']}, fp) yaml.safe_dump({'resource_list' : data['data']}, fp)
return True return True
except: except:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册