Fixed an issue with absolute paths on windows.
This commit is contained in:
parent
236666eaf6
commit
cc3ce840d9
3 changed files with 7 additions and 4 deletions
|
|
@ -140,8 +140,6 @@ class Setting(object):
|
||||||
new_bytes = file.read(extract_path)
|
new_bytes = file.read(extract_path)
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
log(e)
|
log(e)
|
||||||
print e
|
|
||||||
print e
|
|
||||||
|
|
||||||
if new_bytes is not None:
|
if new_bytes is not None:
|
||||||
fbytes.append((dest_path, new_bytes))
|
fbytes.append((dest_path, new_bytes))
|
||||||
|
|
@ -599,9 +597,10 @@ class CommandBase(object):
|
||||||
if os.path.isabs(f_path):
|
if os.path.isabs(f_path):
|
||||||
try:
|
try:
|
||||||
shutil.copy(setting.value, self.project_dir())
|
shutil.copy(setting.value, self.project_dir())
|
||||||
setting.value = os.path.basename(setting.value)
|
|
||||||
except shutil.Error as e: # same file warning
|
except shutil.Error as e: # same file warning
|
||||||
log('Warning: {}'.format(e))
|
log('Warning: {}'.format(e))
|
||||||
|
finally:
|
||||||
|
setting.value = os.path.basename(setting.value)
|
||||||
|
|
||||||
os.chdir(old_dir)
|
os.chdir(old_dir)
|
||||||
|
|
||||||
|
|
|
||||||
3
main.py
3
main.py
|
|
@ -1,6 +1,6 @@
|
||||||
from utils import log, open_folder_in_explorer
|
from utils import log, open_folder_in_explorer
|
||||||
|
|
||||||
__gui_version__ = "v0.1.14b"
|
__gui_version__ = "v0.1.16b"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
|
|
@ -519,6 +519,7 @@ class MainWindow(QtGui.QWidget, CommandBase):
|
||||||
QtCore.QDir.currentPath()),
|
QtCore.QDir.currentPath()),
|
||||||
setting.file_types)
|
setting.file_types)
|
||||||
if file_path:
|
if file_path:
|
||||||
|
file_path = os.path.abspath(file_path) # fixes an issue with windows paths
|
||||||
file_path = file_path.replace(self.project_dir()+os.path.sep, '')
|
file_path = file_path.replace(self.project_dir()+os.path.sep, '')
|
||||||
text_obj.setText(file_path)
|
text_obj.setText(file_path)
|
||||||
setting.last_value = file_path
|
setting.last_value = file_path
|
||||||
|
|
|
||||||
3
utils.py
3
utils.py
|
|
@ -20,6 +20,9 @@ def get_temp_dir():
|
||||||
def log(*args):
|
def log(*args):
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print(*args)
|
print(*args)
|
||||||
|
with open('error.log', 'a+') as f:
|
||||||
|
f.write(', '.join(args))
|
||||||
|
f.write('\n')
|
||||||
|
|
||||||
def open_folder_in_explorer(path):
|
def open_folder_in_explorer(path):
|
||||||
if platform.system() == "Windows":
|
if platform.system() == "Windows":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue