Skip to content

Commit

Permalink
Fix #164: Relative output directory not processing in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jyapayne committed Nov 19, 2016
1 parent ad8e3eb commit 8480dca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 1 addition & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,7 @@ def output_dir(self):
if os.path.isabs(self.output_line.text()):
return self.output_line.text()
else:
return utils.path_join(self.project_dir(),
self.output_line.text())
return utils.abs_path(self.output_line.text())
return ''

def create_download_bar(self):
Expand Down
16 changes: 12 additions & 4 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ def get_temp_dir():

def path_join(base, *rest):
new_rest = []
for i in range(len(rest)):
new_rest.append(str(rest[i]))
for r in rest:
new_rest.append(str(r))

rpath = '/'.join(new_rest)

Expand All @@ -141,6 +141,14 @@ def get_data_path(dir_path):

return data_path

def abs_path(file_path):
path = os.path.abspath(file_path)

if is_windows():
path = path.replace('/', '\\')

return path

def get_data_file_path(file_path):
parts = file_path.split('/')
data_path = get_data_path('/'.join(parts[:-1]))
Expand Down Expand Up @@ -170,9 +178,9 @@ def move(src, dest, **kwargs):

def copytree(src, dest, **kwargs):
if is_windows():
if os.path.isabs(src):
if os.path.isabs(src) and not src.startswith('\\\\'):
src = '\\\\?\\'+src.replace('/', '\\')
if os.path.isabs(dest):
if os.path.isabs(dest) and not dest.startswith('\\\\'):
dest = '\\\\?\\'+dest.replace('/', '\\')
shutil.copytree(src, dest, **kwargs)

Expand Down

0 comments on commit 8480dca

Please sign in to comment.