AbigailBuccaneer / json2cmake

Generate CMakeLists.txt from a compile_commands.json
MIT License
36 stars 15 forks source link

Windows paths should use forward slash #35

Open AbigailBuccaneer opened 5 years ago

AbigailBuccaneer commented 5 years ago

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.

andrewkwon commented 4 years ago

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))