Fix issue with changing working dir

This commit is contained in:
Ivan Kravets
2023-07-25 15:55:09 +03:00
parent a3ad3103ef
commit 33abe19831
2 changed files with 5 additions and 7 deletions

View File

@ -34,11 +34,9 @@ class cd:
self.prev_path = os.getcwd()
def __enter__(self):
if self.new_path != self.prev_path:
os.chdir(self.new_path)
def __exit__(self, etype, value, traceback):
if self.new_path != self.prev_path:
os.chdir(self.prev_path)

View File

@ -22,7 +22,7 @@ from platformio.home.rpc.handlers.base import BaseRPCHandler
from platformio.package.manager.platform import PlatformPackageManager
from platformio.platform.factory import PlatformFactory
from platformio.project.config import ProjectConfig
from platformio.project.helpers import get_project_dir, is_platformio_project
from platformio.project.helpers import get_project_dir
from platformio.project.integration.generator import ProjectGenerator
@ -111,11 +111,11 @@ class ProjectRPC(BaseRPCHandler):
@staticmethod
def configuration(project_dir, env):
assert is_platformio_project(project_dir)
with fs.cd(project_dir):
config = ProjectConfig.get_instance()
config.validate(envs=[env])
platform = PlatformFactory.from_env(env, autoinstall=True)
platform_pkg = PlatformPackageManager().get_package(platform.get_dir())
config = ProjectConfig.get_instance()
board_id = config.get(f"env:{env}", "board", None)
# frameworks