Skip to content

Commit

Permalink
use abspath for config
Browse files Browse the repository at this point in the history
  • Loading branch information
elesiuta committed Oct 15, 2019
1 parent 7f6d312 commit 443a0ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion backupy.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ def __init__(self, args):

def saveJson(self):
self.config.save, self.config.load = False, False
self.config.source = os.path.abspath(self.config.source)
self.config.dest = os.path.abspath(self.config.dest)
writeJson(os.path.join(self.config.source, self.config.config_dir, "config.json"), vars(self.config))
print("Config saved")
sys.exit()
Expand All @@ -284,7 +286,7 @@ def loadJson(self):
current_source = self.config.source
config = readJson(os.path.join(self.config.source, self.config.config_dir, "config.json"))
self.config = ConfigObject(config)
if current_source != self.config.source:
if os.path.abspath(current_source) != os.path.abspath(self.config.source):
print("The specified source does not match the loaded config file, exiting")
sys.exit()

Expand Down Expand Up @@ -546,3 +548,5 @@ def main():
# TODO
# 1. Increase test coverage
# 2. Release gooey build
# 3. Replace source_root and dest_root with config.source and config.dest and convert to abspath in init
# 4. Use colourString in more print statements
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="backupy",
version="0.2.2",
version="0.2.3",
description="Simple python script for backing up directories",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 443a0ba

Please sign in to comment.