Skip to content

Commit bc8aa4b

Browse files
committed
utils: adjust to support long paths on windows
Windows restricts paths to 251 characters. Using unicode paths will allow us to go down the `_wfopen` path which permits the use of the NT path to actually use long paths.
1 parent 4ee879e commit bc8aa4b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

utils/jobstats/jobstats.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import itertools
2020
import json
2121
import os
22+
import platform
2223
import random
2324
import re
2425

@@ -315,7 +316,13 @@ def load_stats_dir(path, select_module=[], select_stat=[],
315316
continue
316317
jobargs = [mg["input"], mg["triple"], mg["out"], mg["opt"]]
317318

318-
with open(os.path.join(root, f)) as fp:
319+
if platform.system() == 'Windows':
320+
p = unicode(u"\\\\?\\%s" % os.path.abspath(os.path.join(root,
321+
f)))
322+
else:
323+
p = os.path.join(root, f)
324+
325+
with open(p) as fp:
319326
j = json.load(fp)
320327
dur_usec = 1
321328
stats = dict()

0 commit comments

Comments
 (0)