Fix path for Windows-based projects

This commit is contained in:
Ivan Kravets
2015-09-04 20:35:56 +03:00
parent a032026f46
commit c254a3490c
4 changed files with 14 additions and 11 deletions

View File

@ -75,12 +75,9 @@ def main():
try:
requests.packages.urllib3.disable_warnings()
except AttributeError:
click.secho(
raise exception.PlatformioException(
"Invalid installation of Python `requests` package`. See "
"< https://github.com/platformio/platformio/issues/252 >",
fg="red", err=True
)
return 1
"< https://github.com/platformio/platformio/issues/252 >")
cli(None, None, None)
except Exception as e: # pylint: disable=W0703

View File

@ -3,6 +3,7 @@
import json
import os
import re
from os.path import abspath, basename, expanduser, isdir, join, relpath
import bottle
@ -88,7 +89,7 @@ class ProjectGenerator(object):
continue
_relpath = root.replace(tpls_dir, "")
if _relpath.startswith(os.sep):
_relpath = _relpath[len(os.sep):]
_relpath = _relpath[1:]
tpls.append((_relpath, join(root, f)))
return tpls
@ -119,7 +120,12 @@ class ProjectGenerator(object):
"user_home_dir": abspath(expanduser("~")),
"project_dir": self.project_dir,
"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_path": os.getenv("PATH")
"env_path": self._fix_os_path(os.getenv("PATH"))
})
@staticmethod
def _fix_os_path(path):
return re.sub(r"[\\]+", "\\\\", path)

View File

@ -1,6 +1,6 @@
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/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/appendContributed=false

View File

@ -8,7 +8,7 @@
"-f", "-c", "sublimetext",
"run"
],
"path": "{{env_path}}"
"path": "{{env_path}}",
"name": "PlatformIO",
"variants":
[