json2cmake icon indicating copy to clipboard operation
json2cmake copied to clipboard

Windows paths should use forward slash

Open AbigailBuccaneer opened this issue 5 years ago • 1 comments

When running on Windows, we output paths like "c:\users\...", and \u is interpreted as an escape sequence. We should instead output "c:/users/..." even if the compile_commands.json uses backslashes.

AbigailBuccaneer avatar Mar 14 '19 10:03 AbigailBuccaneer

I believe this issue can be resolved by replacing the return statement of the resolve(path) function on line 96 of __init__.py with the following code:

if sys.platform.startswith('win32'):
    return os.path.normcase(os.path.normpath(path)).replace("\\", "/") # Windows fix so that paths have correct slashes
else:
    return os.path.normcase(os.path.normpath(path))

andrewkwon avatar Jun 10 '20 22:06 andrewkwon