Skip to content

Commit

Permalink
Expanding user directories and variables in paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Axadiw committed Jun 25, 2015
1 parent 550c348 commit aafba57
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion basset/helpers/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def convert_single_file(self, source_file, destination_file, target_resolution,
target_resolution[0],
target_resolution[1],
destination_file)
logging.info(convert_string)

os.system(convert_string)

Expand Down Expand Up @@ -95,6 +94,9 @@ def convert(self):
self.input_dir = self.input_dir.rstrip('\\/')
self.output_dir = self.output_dir.rstrip('\\/')

self.input_dir = os.path.expandvars(os.path.expanduser(self.input_dir))
self.output_dir = os.path.expandvars(os.path.expanduser(self.output_dir))

logging.info("Converting vector files from {0} to {1}".format(self.input_dir, self.output_dir))

temp_file = os.path.join(self.output_dir, ".basset_temp")
Expand Down
4 changes: 4 additions & 0 deletions basset/helpers/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def __init__(self):
def extract(self):
self.input_dir = self.input_dir.rstrip('\\/')
self.output_dir = self.output_dir.rstrip('\\/')

self.input_dir = os.path.expandvars(os.path.expanduser(self.input_dir))
self.output_dir = os.path.expandvars(os.path.expanduser(self.output_dir))

logging.info("Extracting vector files from {0} to {1}".format(self.input_dir, self.output_dir))

if not self.input_dir.endswith(".xcassets"):
Expand Down
4 changes: 3 additions & 1 deletion basset/helpers/merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def merge(self):
self.source_assets_dir = self.source_assets_dir.rstrip('\\/')
self.default_xcasset_dir = self.default_xcasset_dir.rstrip('\\/')

self.source_assets_dir = os.path.expandvars(os.path.expanduser(self.source_assets_dir))
self.default_xcasset_dir = os.path.expandvars(os.path.expanduser(self.default_xcasset_dir))

logging.info("Merging assets from {0} using {1} as default xcassets".format(self.source_assets_dir,
self.default_xcasset_dir))

Expand All @@ -66,7 +69,6 @@ def merge(self):
if not os.path.isdir(asset_dir_in_destination_xcasset):
os.makedirs(asset_dir_in_destination_xcasset)


# Create / update JSON file
content_json_file_path = os.path.join(asset_dir_in_destination_xcasset, "Contents.json")

Expand Down

0 comments on commit aafba57

Please sign in to comment.