forked from platformio/platformio-core
Fix path for Windows-based projects
This commit is contained in:
@ -75,12 +75,9 @@ def main():
|
|||||||
try:
|
try:
|
||||||
requests.packages.urllib3.disable_warnings()
|
requests.packages.urllib3.disable_warnings()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
click.secho(
|
raise exception.PlatformioException(
|
||||||
"Invalid installation of Python `requests` package`. See "
|
"Invalid installation of Python `requests` package`. See "
|
||||||
"< https://github.com/platformio/platformio/issues/252 >",
|
"< https://github.com/platformio/platformio/issues/252 >")
|
||||||
fg="red", err=True
|
|
||||||
)
|
|
||||||
return 1
|
|
||||||
|
|
||||||
cli(None, None, None)
|
cli(None, None, None)
|
||||||
except Exception as e: # pylint: disable=W0703
|
except Exception as e: # pylint: disable=W0703
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
from os.path import abspath, basename, expanduser, isdir, join, relpath
|
from os.path import abspath, basename, expanduser, isdir, join, relpath
|
||||||
|
|
||||||
import bottle
|
import bottle
|
||||||
@ -88,7 +89,7 @@ class ProjectGenerator(object):
|
|||||||
continue
|
continue
|
||||||
_relpath = root.replace(tpls_dir, "")
|
_relpath = root.replace(tpls_dir, "")
|
||||||
if _relpath.startswith(os.sep):
|
if _relpath.startswith(os.sep):
|
||||||
_relpath = _relpath[len(os.sep):]
|
_relpath = _relpath[1:]
|
||||||
tpls.append((_relpath, join(root, f)))
|
tpls.append((_relpath, join(root, f)))
|
||||||
return tpls
|
return tpls
|
||||||
|
|
||||||
@ -119,7 +120,12 @@ class ProjectGenerator(object):
|
|||||||
"user_home_dir": abspath(expanduser("~")),
|
"user_home_dir": abspath(expanduser("~")),
|
||||||
"project_dir": self.project_dir,
|
"project_dir": self.project_dir,
|
||||||
"systype": util.get_systype(),
|
"systype": util.get_systype(),
|
||||||
"platformio_path": util.where_is_program("platformio"),
|
"platformio_path": self._fix_os_path(
|
||||||
|
util.where_is_program("platformio")),
|
||||||
"env_pathsep": os.pathsep,
|
"env_pathsep": os.pathsep,
|
||||||
"env_path": os.getenv("PATH")
|
"env_path": self._fix_os_path(os.getenv("PATH"))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _fix_os_path(path):
|
||||||
|
return re.sub(r"[\\]+", "\\\\", path)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
environment/project/0.910961921/PATH/delimiter=\{{env_pathsep}}
|
environment/project/0.910961921/PATH/delimiter={{env_pathsep.replace(":", "\\:")}}
|
||||||
environment/project/0.910961921/PATH/operation=replace
|
environment/project/0.910961921/PATH/operation=replace
|
||||||
environment/project/0.910961921/PATH/value={{env_path.replace(env_pathsep, "\\%s" % env_pathsep)}}
|
environment/project/0.910961921/PATH/value={{env_path.replace(":", "\\:")}}
|
||||||
environment/project/0.910961921/append=true
|
environment/project/0.910961921/append=true
|
||||||
environment/project/0.910961921/appendContributed=false
|
environment/project/0.910961921/appendContributed=false
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"-f", "-c", "sublimetext",
|
"-f", "-c", "sublimetext",
|
||||||
"run"
|
"run"
|
||||||
],
|
],
|
||||||
"path": "{{env_path}}"
|
"path": "{{env_path}}",
|
||||||
"name": "PlatformIO",
|
"name": "PlatformIO",
|
||||||
"variants":
|
"variants":
|
||||||
[
|
[
|
||||||
|
Reference in New Issue
Block a user