mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Automatically normalize file system paths to UNIX-style for Project Generator // Resolve #2857
This commit is contained in:
@ -13,6 +13,7 @@ PlatformIO 4.0
|
|||||||
* Do not shutdown PIO Home Server for "upgrade" operations (`issue #2784 <https://github.com/platformio/platformio-core/issues/2784>`_)
|
* Do not shutdown PIO Home Server for "upgrade" operations (`issue #2784 <https://github.com/platformio/platformio-core/issues/2784>`_)
|
||||||
* Improved computing of project check sum (structure, configuration) and avoid unnecessary rebuilding
|
* Improved computing of project check sum (structure, configuration) and avoid unnecessary rebuilding
|
||||||
* Improved printing of tabulated results
|
* Improved printing of tabulated results
|
||||||
|
* Automatically normalize file system paths to UNIX-style for Project Generator (`issue #2857 <https://github.com/platformio/platformio-core/issues/2857>`_)
|
||||||
* Ability to set "databaseFilename" for VSCode and C/C++ extension (`issue #2825 <https://github.com/platformio/platformio-core/issues/2825>`_)
|
* Ability to set "databaseFilename" for VSCode and C/C++ extension (`issue #2825 <https://github.com/platformio/platformio-core/issues/2825>`_)
|
||||||
* Renamed "enable_ssl" setting to `strict_ssl <http://docs.platformio.org/page/userguide/cmd_settings.html#strict-ssl>`__
|
* Renamed "enable_ssl" setting to `strict_ssl <http://docs.platformio.org/page/userguide/cmd_settings.html#strict-ssl>`__
|
||||||
* Fixed an issue with incorrect escaping of Windows slashes when using `PIO Unified Debugger <http://docs.platformio.org/page/plus/debugging.html>`__ and "piped" openOCD
|
* Fixed an issue with incorrect escaping of Windows slashes when using `PIO Unified Debugger <http://docs.platformio.org/page/plus/debugging.html>`__ and "piped" openOCD
|
||||||
|
@ -73,10 +73,10 @@ class ProjectGenerator(object):
|
|||||||
"project_dir": self.project_dir,
|
"project_dir": self.project_dir,
|
||||||
"env_name": self.env_name,
|
"env_name": self.env_name,
|
||||||
"user_home_dir": abspath(expanduser("~")),
|
"user_home_dir": abspath(expanduser("~")),
|
||||||
"platformio_path": self._fix_os_path(
|
"platformio_path":
|
||||||
sys.argv[0] if isfile(sys.argv[0])
|
sys.argv[0] if isfile(sys.argv[0])
|
||||||
else where_is_program("platformio")),
|
else where_is_program("platformio"),
|
||||||
"env_path": self._fix_os_path(os.getenv("PATH")),
|
"env_path": os.getenv("PATH"),
|
||||||
"env_pathsep": os.pathsep
|
"env_pathsep": os.pathsep
|
||||||
} # yapf: disable
|
} # yapf: disable
|
||||||
|
|
||||||
@ -95,11 +95,23 @@ class ProjectGenerator(object):
|
|||||||
get_project_libdeps_dir(), self.env_name)
|
get_project_libdeps_dir(), self.env_name)
|
||||||
|
|
||||||
}) # yapf: disable
|
}) # yapf: disable
|
||||||
|
|
||||||
|
for key, value in tpl_vars.items():
|
||||||
|
if key.endswith(("_path", "_dir")):
|
||||||
|
tpl_vars[key] = self.to_unix_path(value)
|
||||||
|
for key in ("includes", "src_files", "libsource_dirs"):
|
||||||
|
if key not in tpl_vars:
|
||||||
|
continue
|
||||||
|
tpl_vars[key] = [self.to_unix_path(inc) for inc in tpl_vars[key]]
|
||||||
|
|
||||||
|
tpl_vars['to_unix_path'] = self.to_unix_path
|
||||||
return tpl_vars
|
return tpl_vars
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _fix_os_path(path):
|
def to_unix_path(path):
|
||||||
return (re.sub(r"[\\]+", '\\' * 4, path) if WINDOWS else path)
|
if not WINDOWS or not path:
|
||||||
|
return path
|
||||||
|
return re.sub(r"[\\]+", "/", path)
|
||||||
|
|
||||||
def get_src_files(self):
|
def get_src_files(self):
|
||||||
result = []
|
result = []
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
% _defines = " ".join(["-D%s" % d for d in defines])
|
% _defines = " ".join(["-D%s" % d for d in defines])
|
||||||
{
|
{
|
||||||
"execPath": "{{ cxx_path.replace("\\", "/") }}",
|
"execPath": "{{ cxx_path }}",
|
||||||
"gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
|
"gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
|
||||||
"gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
|
"gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
|
||||||
"gccErrorLimit": 15,
|
"gccErrorLimit": 15,
|
||||||
"gccIncludePaths": "{{ ','.join(includes).replace("\\", "/") }}",
|
"gccIncludePaths": "{{ ','.join(includes) }}",
|
||||||
"gccSuppressWarnings": false
|
"gccSuppressWarnings": false
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
% path = path.replace(user_home_dir, "$ENV{HOME}")
|
% path = path.replace(user_home_dir, "$ENV{HOME}")
|
||||||
% end
|
% end
|
||||||
% end
|
% end
|
||||||
% return path.replace("\\", "/")
|
% return path
|
||||||
% end
|
% end
|
||||||
|
|
||||||
set(PLATFORMIO_CMD "{{ _normalize_path(platformio_path) }}")
|
set(PLATFORMIO_CMD "{{ _normalize_path(platformio_path) }}")
|
||||||
|
@ -53,12 +53,12 @@
|
|||||||
<Add option="-D{{define}}"/>
|
<Add option="-D{{define}}"/>
|
||||||
% end
|
% end
|
||||||
% for include in includes:
|
% for include in includes:
|
||||||
<Add directory="{{include.replace("\\", "/")}}"/>
|
<Add directory="{{include}}"/>
|
||||||
% end
|
% end
|
||||||
</Compiler>
|
</Compiler>
|
||||||
<Unit filename="platformio.ini" />
|
<Unit filename="platformio.ini" />
|
||||||
% for file in src_files:
|
% for file in src_files:
|
||||||
<Unit filename="{{file.replace("\\", "/")}}"></Unit>
|
<Unit filename="{{file}}"></Unit>
|
||||||
% end
|
% end
|
||||||
</Project>
|
</Project>
|
||||||
</CodeBlocks_project_file>
|
</CodeBlocks_project_file>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
% _defines = " ".join(["-D%s" % d for d in defines])
|
% _defines = " ".join(["-D%s" % d for d in defines])
|
||||||
{
|
{
|
||||||
"execPath": "{{ cxx_path.replace("\\", "/") }}",
|
"execPath": "{{ cxx_path }}",
|
||||||
"gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
|
"gccDefaultCFlags": "-fsyntax-only {{! cc_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
|
||||||
"gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
|
"gccDefaultCppFlags": "-fsyntax-only {{! cxx_flags.replace(' -MMD ', ' ').replace('"', '\\"') }} {{ !_defines.replace('"', '\\"') }}",
|
||||||
"gccErrorLimit": 15,
|
"gccErrorLimit": 15,
|
||||||
"gccIncludePaths": "{{! ','.join("'{}'".format(w.replace("\\", '/')) for w in includes)}}",
|
"gccIncludePaths": "{{! ','.join("'{}'".format(inc) for inc in includes)}}",
|
||||||
"gccSuppressWarnings": false
|
"gccSuppressWarnings": false
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
% systype = platform.system().lower()
|
% systype = platform.system().lower()
|
||||||
%
|
%
|
||||||
% def _escape(text):
|
% def _escape(text):
|
||||||
% return text.replace('\\\\', '/').replace('\\', '/').replace('"', '\\"')
|
% return to_unix_path(text).replace('"', '\\"')
|
||||||
% end
|
% end
|
||||||
%
|
%
|
||||||
% cleaned_includes = []
|
% cleaned_includes = []
|
||||||
@ -30,7 +30,7 @@
|
|||||||
% end
|
% end
|
||||||
"includePath": [
|
"includePath": [
|
||||||
% for include in cleaned_includes:
|
% for include in cleaned_includes:
|
||||||
"{{! _escape(include) }}",
|
"{{ include }}",
|
||||||
% end
|
% end
|
||||||
""
|
""
|
||||||
],
|
],
|
||||||
@ -38,7 +38,7 @@
|
|||||||
"limitSymbolsToIncludedHeaders": true,
|
"limitSymbolsToIncludedHeaders": true,
|
||||||
"path": [
|
"path": [
|
||||||
% for include in cleaned_includes:
|
% for include in cleaned_includes:
|
||||||
"{{! _escape(include) }}",
|
"{{ include }}",
|
||||||
% end
|
% end
|
||||||
""
|
""
|
||||||
]
|
]
|
||||||
@ -64,7 +64,7 @@
|
|||||||
% if cxx_stds:
|
% if cxx_stds:
|
||||||
"cppStandard": "c++{{ cxx_stds[-1] }}",
|
"cppStandard": "c++{{ cxx_stds[-1] }}",
|
||||||
% end
|
% end
|
||||||
"compilerPath": "\"{{! _escape(cc_path) }}\" {{! _escape(cc_m_flags) }}"
|
"compilerPath": "\"{{cc_path}}\" {{! _escape(cc_m_flags) }}"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version": 4
|
"version": 4
|
||||||
|
Reference in New Issue
Block a user