Better os.path.join function

This commit is contained in:
Fierelier 2022-06-22 07:17:54 +02:00
parent 088d926467
commit 4e939d3ad5

23
run.py
View File

@ -8,7 +8,28 @@ def newexcepthook(type,value,traceback):
sys.excepthook = newexcepthook
import os
p = os.path.join
def p(*args):
args = list(args)
index = 0
length = len(args)
while index < length:
arg = args[index]
arg = arg.replace("/",os.path.sep)
arg = arg.replace("\\",os.path.sep)
if index != 0: arg = arg.lstrip(os.path.sep)
arg = arg.rstrip(os.path.sep)
while os.path.sep + os.path.sep in arg:
arg = arg.replace(os.path.sep + os.path.sep,os.path.sep)
if arg == "":
del args[index]
length -= 1
continue
args[index] = arg
index += 1
return os.path.sep.join(args)
pUp = os.path.dirname
s = False
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):