Skip to content

Commit e030000

Browse files
committed
Preprocess: Fix filename conflict on case-insensitive filesystems (case 26)
1 parent b14a63d commit e030000

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

preprocess.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@
7272

7373

7474
# find files that need to be renamed
75-
files_rename_qs = []
76-
files_rename_quot = []
77-
files_loader = []
75+
files_rename_qs = [] # remove query string
76+
files_rename_quot = [] # remove quotes
77+
files_loader = [] # files served by load.php
7878
for root, dirnames, filenames in os.walk('output/reference/'):
7979
for filename in fnmatch.filter(filenames, '*[?]*'):
8080
files_rename_qs.append((root, filename))
@@ -90,6 +90,9 @@
9090
rename_map = []
9191
def rename_file(root, fn, new_fn):
9292
path = os.path.join(root,fn)
93+
if not os.path.isfile(path):
94+
print("Not renaming " + path)
95+
return
9396
new_path = os.path.join(root,new_fn)
9497
shutil.move(path, new_path)
9598
rename_map.append((fn, new_fn))
@@ -117,6 +120,11 @@ def rename_file(root, fn, new_fn):
117120

118121
rename_file(root, fn, new_fn)
119122

123+
# rename filenames that conflict on case-insensitive filesystems
124+
# TODO: perform this automatically
125+
rename_file('output/reference/en/cpp/numeric/math', 'NAN.html', 'NAN.2.html')
126+
rename_file('output/reference/en/c/numeric/math', 'NAN.html', 'NAN.2.html')
127+
120128
# find files that need to be preprocessed
121129
html_files = []
122130
for root, dirnames, filenames in os.walk('output/reference/'):

0 commit comments

Comments
 (0)