Skip to content

Commit 6ca7674

Browse files
committed
* update 优化Windows与Linux直接路径转换方法
1 parent dfda1e0 commit 6ca7674

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

jade/jade_packing.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ def ui_to_py():
3535
os.system("pyuic5 -o {}.py {}".format(view_file.split(".ui")[0],view_file))
3636
progressBar.update()
3737

38-
def getOperationSystem():
39-
return platform.system()
40-
41-
42-
4338
def get_import_content(f1,src_import,content,import_list):
4439
prefix_list = content.split("from")[1].split("import")[0].split(".")[:-1]
4540
prefix = ""

jade/jade_tools.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
import time
1313
import shutil
1414
from jade.jade_progress_bar import ProgressBar
15-
from jade.jade_packing import getOperationSystem
1615
import socket
16+
import platform
17+
1718
def zh_ch(string):
1819
"""
1920
解决cv2.namedWindow中文乱码问题
@@ -289,6 +290,11 @@ def get_ip_address(ip_address="127.0.0.1"):
289290
finally:
290291
pass
291292
return ip
293+
"""
294+
获取操作系统
295+
"""
296+
def getOperationSystem():
297+
return platform.system()
292298

293299
"""
294300
Windows与Linux直接路径转换
@@ -298,11 +304,20 @@ def ConvertPath(file_path):
298304
if getOperationSystem() == "Windows":
299305
pass
300306
elif getOperationSystem() == "Linux":
301-
file_path = file_path.replace("\\","/")
302-
file_path = "/mnt/" + file_path.split(":")[0].lower() + file_path.split(":")[1]
307+
try:
308+
file_path = file_path.replace("\\","/")
309+
except:
310+
pass
311+
try:
312+
file_path = "/mnt/" + file_path.split(":")[0].lower() + file_path.split(":")[1]
313+
except:
314+
pass
303315
else:
304316
if getOperationSystem() == "Windows":
305-
file_path = file_path.split("/mnt/")[1][0].upper() + ":" + file_path.split("/mnt/")[1][1:]
317+
try:
318+
file_path = file_path.split("/mnt/")[1][0].upper() + ":" + file_path.split("/mnt/")[1][1:]
319+
except:
320+
pass
306321
elif getOperationSystem() == "Linux":
307322
pass
308323
if os.path.exists(file_path):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
find_packages("jade", pack_list)
1313
setup(
1414
name="jade",
15-
version="1.2.0",
15+
version="1.2.2",
1616
keywords=("pip", "jade", ""),
1717
description="jade",
1818
long_description="",

0 commit comments

Comments
 (0)