Skip to content

Commit

Permalink
Resolved an issue where the --project-dir flag did not function c…
Browse files Browse the repository at this point in the history
…orrectly with the check and debug commands // Resolve #5029
  • Loading branch information
ivankravets committed Dec 13, 2024
1 parent 1d4b5c8 commit d153146
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
~~~~~~~~~~~~~~~~~~~
Expand Down
9 changes: 4 additions & 5 deletions platformio/check/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import os
import shutil
from collections import Counter
from os.path import dirname, isfile
from time import time

import click
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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()}
Expand Down Expand Up @@ -250,12 +249,12 @@ def _append_defect(component, defect):
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
Expand Down
4 changes: 2 additions & 2 deletions platformio/debug/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand All @@ -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

Expand Down

0 comments on commit d153146

Please sign in to comment.