mirror of
https://github.com/leminlimez/Nugget.git
synced 2025-04-08 04:23:05 +08:00
fix windows FileNotFound error fr this time :trollface:
This commit is contained in:
12
controllers/path_handler.py
Normal file
12
controllers/path_handler.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import os
|
||||
|
||||
def fix_windows_path(dos_path: str, encoding=None):
|
||||
if os.name == 'nt':
|
||||
if (not isinstance(dos_path, str) and encoding is not None):
|
||||
dos_path = dos_path.decode(encoding)
|
||||
path = os.path.abspath(dos_path)
|
||||
if path.startswith(u"\\\\"):
|
||||
return u"\\\\?\\UNC\\" + path[2:]
|
||||
return u"\\\\?\\" + path
|
||||
else:
|
||||
return dos_path
|
||||
Reference in New Issue
Block a user