Skip to content

Commit 8480dca

Browse files
committed
Fix #164: Relative output directory not processing in windows
1 parent ad8e3eb commit 8480dca

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,7 @@ def output_dir(self):
479479
if os.path.isabs(self.output_line.text()):
480480
return self.output_line.text()
481481
else:
482-
return utils.path_join(self.project_dir(),
483-
self.output_line.text())
482+
return utils.abs_path(self.output_line.text())
484483
return ''
485484

486485
def create_download_bar(self):

utils.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ def get_temp_dir():
116116

117117
def path_join(base, *rest):
118118
new_rest = []
119-
for i in range(len(rest)):
120-
new_rest.append(str(rest[i]))
119+
for r in rest:
120+
new_rest.append(str(r))
121121

122122
rpath = '/'.join(new_rest)
123123

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

142142
return data_path
143143

144+
def abs_path(file_path):
145+
path = os.path.abspath(file_path)
146+
147+
if is_windows():
148+
path = path.replace('/', '\\')
149+
150+
return path
151+
144152
def get_data_file_path(file_path):
145153
parts = file_path.split('/')
146154
data_path = get_data_path('/'.join(parts[:-1]))
@@ -170,9 +178,9 @@ def move(src, dest, **kwargs):
170178

171179
def copytree(src, dest, **kwargs):
172180
if is_windows():
173-
if os.path.isabs(src):
181+
if os.path.isabs(src) and not src.startswith('\\\\'):
174182
src = '\\\\?\\'+src.replace('/', '\\')
175-
if os.path.isabs(dest):
183+
if os.path.isabs(dest) and not dest.startswith('\\\\'):
176184
dest = '\\\\?\\'+dest.replace('/', '\\')
177185
shutil.copytree(src, dest, **kwargs)
178186

0 commit comments

Comments
 (0)