Skip to content

Commit 53560fe

Browse files
authored
Merge pull request swiftlang#34265 from drodriguez/windows-rewrite-module-triples
[windows] Use extended length paths for os.walk invocation.
2 parents 1de9668 + 2a7a3eb commit 53560fe

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

test/CrossImport/Inputs/rewrite-module-triples.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
sys.exit(1)
1818

1919
root_dir = sys.argv[1]
20+
if platform.system() == 'Windows':
21+
root_dir = "\\\\?\\" + os.path.abspath(root_dir)
22+
2023
triples = sys.argv[2:]
2124

2225

@@ -37,16 +40,9 @@ def rewrite(parent, names, copy_fn, rm_fn):
3740

3841
for new_name in new_names:
3942
new_path = os.path.join(parent, new_name)
40-
if platform.system() == 'Windows':
41-
copy_fn(u'\\'.join([u'\\\\?', os.path.normpath(path)]),
42-
u'\\'.join([u'\\\\?', os.path.normpath(new_path)]))
43-
else:
44-
copy_fn(path, new_path)
45-
46-
if platform.system() == 'Windows':
47-
rm_fn(u'\\'.join([u'\\\\?', os.path.normpath(path)]))
48-
else:
49-
rm_fn(path)
43+
copy_fn(path, new_path)
44+
45+
rm_fn(path)
5046

5147

5248
for parent, dirs, files in os.walk(root_dir, topdown=False):

0 commit comments

Comments
 (0)