Skip to content

Commit d153146

Browse files
committed
Resolved an issue where the --project-dir flag did not function correctly with the check and debug commands // Resolve platformio#5029
1 parent 1d4b5c8 commit d153146

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ test-driven methodologies, and modern toolchains for unrivaled success.
2525
* Ensured that dependencies of private libraries are no longer unnecessarily re-installed, optimizing dependency management and reducing redundant operations (`issue #4987 <https://github.com/platformio/platformio-core/issues/4987>`_)
2626
* Resolved an issue where the ``compiledb`` target failed to properly escape compiler executable paths containing spaces (`issue #4998 <https://github.com/platformio/platformio-core/issues/4998>`_)
2727
* Resolved an issue with incorrect path resolution when linking static libraries via the `build_flags <https://docs.platformio.org/en/latest/projectconf/sections/env/options/build/build_flags.html>`__ option (`issue #5004 <https://github.com/platformio/platformio-core/issues/5004>`_)
28+
* Resolved an issue where the ``--project-dir`` flag did not function correctly with the `pio check <https://docs.platformio.org/en/latest/core/userguide/cmd_check.html>`__ and `pio debug <https://docs.platformio.org/en/latest/core/userguide/cmd_debug.html>`__ commands (`issue #5029 <https://github.com/platformio/platformio-core/issues/5029>`_)
2829

2930
6.1.16 (2024-09-26)
3031
~~~~~~~~~~~~~~~~~~~

platformio/check/cli.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import os
2020
import shutil
2121
from collections import Counter
22-
from os.path import dirname, isfile
2322
from time import time
2423

2524
import click
@@ -77,7 +76,7 @@ def cli( # pylint: disable=too-many-positional-arguments
7776
app.set_session_var("custom_project_conf", project_conf)
7877

7978
# find project directory on upper level
80-
if isfile(project_dir):
79+
if os.path.isfile(project_dir):
8180
project_dir = find_project_dir_above(project_dir)
8281

8382
results = []
@@ -150,7 +149,7 @@ def cli( # pylint: disable=too-many-positional-arguments
150149
print_processing_header(tool, envname, env_dump)
151150

152151
ct = CheckToolFactory.new(
153-
tool, project_dir, config, envname, tool_options
152+
tool, os.getcwd(), config, envname, tool_options
154153
)
155154

156155
result = {"env": envname, "tool": tool, "duration": time()}
@@ -250,12 +249,12 @@ def _append_defect(component, defect):
250249
components[component].update({DefectItem.SEVERITY_LABELS[defect.severity]: 1})
251250

252251
for defect in result.get("defects", []):
253-
component = dirname(defect.file) or defect.file
252+
component = os.path.dirname(defect.file) or defect.file
254253
_append_defect(component, defect)
255254

256255
if component.lower().startswith(get_project_dir().lower()):
257256
while os.sep in component:
258-
component = dirname(component)
257+
component = os.path.dirname(component)
259258
_append_defect(component, defect)
260259

261260
return components

platformio/debug/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def cli( # pylint: disable=too-many-positional-arguments
8686

8787
if not interface:
8888
return helpers.predebug_project(
89-
ctx, project_dir, project_config, env_name, False, verbose
89+
ctx, os.getcwd(), project_config, env_name, False, verbose
9090
)
9191

9292
configure_args = (
@@ -106,7 +106,7 @@ def cli( # pylint: disable=too-many-positional-arguments
106106
else:
107107
debug_config = _configure(*configure_args)
108108

109-
_run(project_dir, debug_config, client_extra_args)
109+
_run(os.getcwd(), debug_config, client_extra_args)
110110

111111
return None
112112

0 commit comments

Comments
 (0)