Skip to content
Snippets Groups Projects
Commit 0fe81d25 authored by Mads M. Pedersen's avatar Mads M. Pedersen
Browse files

revert to old unix path method

parent 4223cc4a
No related branches found
No related tags found
No related merge requests found
...@@ -14,7 +14,7 @@ from io import open ...@@ -14,7 +14,7 @@ from io import open
from builtins import str from builtins import str
from future import standard_library from future import standard_library
from wetb.utils.process_exec import pexec from wetb.utils.process_exec import pexec
from wetb.utils.cluster_tools.cluster_resource import unix_path from wetb.utils.cluster_tools.cluster_resource import unix_path, unix_path_old
standard_library.install_aliases() standard_library.install_aliases()
from collections import OrderedDict from collections import OrderedDict
...@@ -104,7 +104,7 @@ class HTCFile(HTCContents, HTCDefaults): ...@@ -104,7 +104,7 @@ class HTCFile(HTCContents, HTCDefaults):
def readfilelines(self, filename): def readfilelines(self, filename):
with open(unix_path(filename), encoding='cp1252') as fid: with open(unix_path_old(filename), encoding='cp1252') as fid:
lines = list(fid.readlines()) lines = list(fid.readlines())
if lines[0].encode().startswith(b'\xc3\xaf\xc2\xbb\xc2\xbf'): if lines[0].encode().startswith(b'\xc3\xaf\xc2\xbb\xc2\xbf'):
lines[0] = lines[0][3:] lines[0] = lines[0][3:]
......
...@@ -42,18 +42,19 @@ def unix_path(path, cwd=None, fail_on_missing=False): ...@@ -42,18 +42,19 @@ def unix_path(path, cwd=None, fail_on_missing=False):
path+="/" path+="/"
return path.replace("\\","/") return path.replace("\\","/")
# filename = os.path.realpath(filename.replace("\\", "/")).replace("\\", "/") def unix_path_old(filename):
# ufn, rest = os.path.splitdrive(filename) filename = os.path.realpath(filename.replace("\\", "/")).replace("\\", "/")
# ufn += "/" ufn, rest = os.path.splitdrive(filename)
# for f in rest[1:].split("/"): ufn += "/"
# f_lst = [f_ for f_ in os.listdir(ufn) if f_.lower() == f.lower()] for f in rest[1:].split("/"):
# if len(f_lst) > 1: f_lst = [f_ for f_ in os.listdir(ufn) if f_.lower() == f.lower()]
# f_lst = [f_ for f_ in f_lst if f_ == f] if len(f_lst) > 1:
# elif len(f_lst) == 0: f_lst = [f_ for f_ in f_lst if f_ == f]
# raise IOError("'%s' not found in '%s'" % (f, ufn)) elif len(f_lst) == 0:
# else: # one match found raise IOError("'%s' not found in '%s'" % (f, ufn))
# ufn = os.path.join(ufn, f_lst[0]) else: # one match found
# return ufn.replace("\\", "/") ufn = os.path.join(ufn, f_lst[0])
return ufn.replace("\\", "/")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment