Raise exception when try to load non-PIO project

This commit is contained in:
Ivan Kravets
2017-12-03 02:15:49 +02:00
parent 05069f7ac6
commit 18b10a7fbf
2 changed files with 5 additions and 6 deletions

View File

@ -23,7 +23,7 @@ from platformio.managers.package import PackageManager
CORE_PACKAGES = { CORE_PACKAGES = {
"contrib-piohome": ">=0.3.2,<2", "contrib-piohome": ">=0.3.2,<2",
"pysite-pioplus": ">=0.4.2,<2", "pysite-pioplus": ">=0.4.2,<2",
"tool-pioplus": ">=0.10.13,<2", "tool-pioplus": ">=0.11.0,<2",
"tool-unity": "~1.20302.1", "tool-unity": "~1.20302.1",
"tool-scons": "~3.20501.2" "tool-scons": "~3.20501.2"
} }

View File

@ -331,11 +331,10 @@ def get_projectdata_dir():
def load_project_config(path=None): def load_project_config(path=None):
if not path or isdir(path): if not path or isdir(path):
project_dir = path or get_project_dir() path = join(path or get_project_dir(), "platformio.ini")
if not is_platformio_project(project_dir): if not isfile(path):
raise exception.NotPlatformIOProject(project_dir) raise exception.NotPlatformIOProject(
path = join(project_dir, "platformio.ini") dirname(path) if path.endswith("platformio.ini") else path)
assert isfile(path)
cp = ProjectConfig() cp = ProjectConfig()
cp.read(path) cp.read(path)
return cp return cp