Resolved an issue where the `--project-dir` flag did not function correctly with the check and debug commands // Resolve #5029

This commit is contained in:
Ivan Kravets
2024-12-13 13:01:40 +02:00
parent 1d4b5c8051
commit d15314689d
3 changed files with 7 additions and 7 deletions

View File

@ -25,6 +25,7 @@ test-driven methodologies, and modern toolchains for unrivaled success.
* 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>`_)
* 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>`_)
* 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>`_)
* 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>`_)
6.1.16 (2024-09-26)
~~~~~~~~~~~~~~~~~~~

View File

@ -19,7 +19,6 @@ import json
import os
import shutil
from collections import Counter
from os.path import dirname, isfile
from time import time
import click
@ -77,7 +76,7 @@ def cli( # pylint: disable=too-many-positional-arguments
app.set_session_var("custom_project_conf", project_conf)
# find project directory on upper level
if isfile(project_dir):
if os.path.isfile(project_dir):
project_dir = find_project_dir_above(project_dir)
results = []
@ -150,7 +149,7 @@ def cli( # pylint: disable=too-many-positional-arguments
print_processing_header(tool, envname, env_dump)
ct = CheckToolFactory.new(
tool, project_dir, config, envname, tool_options
tool, os.getcwd(), config, envname, tool_options
)
result = {"env": envname, "tool": tool, "duration": time()}
@ -250,12 +249,12 @@ def collect_component_stats(result):
components[component].update({DefectItem.SEVERITY_LABELS[defect.severity]: 1})
for defect in result.get("defects", []):
component = dirname(defect.file) or defect.file
component = os.path.dirname(defect.file) or defect.file
_append_defect(component, defect)
if component.lower().startswith(get_project_dir().lower()):
while os.sep in component:
component = dirname(component)
component = os.path.dirname(component)
_append_defect(component, defect)
return components

View File

@ -86,7 +86,7 @@ def cli( # pylint: disable=too-many-positional-arguments
if not interface:
return helpers.predebug_project(
ctx, project_dir, project_config, env_name, False, verbose
ctx, os.getcwd(), project_config, env_name, False, verbose
)
configure_args = (
@ -106,7 +106,7 @@ def cli( # pylint: disable=too-many-positional-arguments
else:
debug_config = _configure(*configure_args)
_run(project_dir, debug_config, client_extra_args)
_run(os.getcwd(), debug_config, client_extra_args)
return None