Skip to content

Commit

Permalink
msvc_tool.py: Don't replace \ with \\ in NormPath
Browse files Browse the repository at this point in the history
No need to use double back slash.
This could help ease the Windows long path issue.

Please see tensorflow/tensorflow#5385

--
Change-Id: Iecca529209499062bfc1351e3a2b46dc51e0be09
Reviewed-on: https://bazel-review.googlesource.com/#/c/7210
MOS_MIGRATED_REVID=138397390
  • Loading branch information
meteorcloudy authored and aehlig committed Nov 8, 2016
1 parent a02eb27 commit 51e4817
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions tools/cpp/wrapper/bin/pydir/msvc_tools.py.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -295,18 +295,13 @@ class WindowsRunner(object):
Error: if path is too long
"""
abspath = os.path.abspath(path)
long_path = abspath.replace('\\', '\\\\')
# We must allow for the drive letter as well, which is three characters, and
# the length of any compiler option ahead of the path,

if len(long_path) + MAX_DRIVE_LENGTH + MAX_OPTION_LENGTH < MAX_PATH:
return long_path
else:
# TODO(pcloudy):
# This still doesn't solve all the problems, because the compiler
# doesn't seem to support long path.
return "\\\\?\\" + long_path
return None
if len(abspath) + MAX_DRIVE_LENGTH + MAX_OPTION_LENGTH > MAX_PATH:
print('Warning: path "' + abspath + '" is > than 260 characters (' +
str(len(abspath)) + '); programs may crash with long arguments')
return abspath

def SetupEnvironment(self):
"""Setup proper path for running.
Expand Down

0 comments on commit 51e4817

Please sign in to comment.