Windows sucks. This may or may not break the Windows build in retaliation.
This commit is contained in:
parent
625f225448
commit
b8e9aabd67
@ -37,14 +37,31 @@ lines = out.splitlines()
|
|||||||
paths = set()
|
paths = set()
|
||||||
roots = {}
|
roots = {}
|
||||||
|
|
||||||
for line in lines:
|
# Lets not even talk about this.
|
||||||
|
def fixWindowsPath(path):
|
||||||
|
import ctypes
|
||||||
|
GetLongPathName = ctypes.windll.kernel32.GetLongPathNameW
|
||||||
|
buffer = ctypes.create_unicode_buffer(260)
|
||||||
|
rv = GetLongPathName(path.capitalize(), buffer, 260)
|
||||||
|
print(rv, buffer.value)
|
||||||
|
if rv == 0 or rv > 260:
|
||||||
|
return path
|
||||||
|
return buffer.value
|
||||||
|
|
||||||
|
for i, line in enumerate(lines):
|
||||||
line = line.strip().split(None, 2)
|
line = line.strip().split(None, 2)
|
||||||
|
|
||||||
if line[0] != 'FILE':
|
if line[0] != 'FILE':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
path = os.path.dirname(line[2])
|
path = line[2]
|
||||||
|
|
||||||
|
if os.name == 'nt' and os.path.exists(path):
|
||||||
|
path = fixWindowsPath(path)
|
||||||
|
line = ' '.join('FILE', line[1], path)
|
||||||
|
lines[i] = line
|
||||||
|
|
||||||
|
path = os.path.dirname(path)
|
||||||
if path in paths:
|
if path in paths:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -64,7 +81,9 @@ for line in lines:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
root = runCommand(['git', 'rev-parse', '--show-toplevel'])
|
root = runCommand(['git', 'rev-parse', '--show-toplevel'])
|
||||||
root = os.path.normcase(root)
|
|
||||||
|
if os.name == 'nt':
|
||||||
|
root = fixWindowsPath(os.path.normcase(root))
|
||||||
|
|
||||||
if root in roots:
|
if root in roots:
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user