mirror of
https://github.com/flipperdevices/flipperzero-firmware.git
synced 2025-12-12 20:59:50 +04:00
fbt/ufbt: Ensure POSIX paths are passed to GDB on all platforms (#3360)
* fbt/ufbt: Ensure POSIX paths are passed to GDB on all platforms GDB heavily dislikes forward slashes from Windows paths and strips them internally instead of normalizing them. Account for this by passing POSIX paths explicitly. * fbt: different approach for posix path handling * fbt, ufbt: further fixes for path handling * fbt: explicit path stringification * linter fixes Co-authored-by: hedger <hedger@users.noreply.github.com> Co-authored-by: hedger <hedger@nanode.su> Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ import re
|
||||
import subprocess
|
||||
import sys
|
||||
import webbrowser
|
||||
from pathlib import Path, PurePosixPath
|
||||
|
||||
import SCons
|
||||
from SCons.Errors import StopError
|
||||
@@ -82,6 +83,27 @@ def resolve_real_dir_node(node):
|
||||
raise StopError(f"Can't find absolute path for {node.name} ({node})")
|
||||
|
||||
|
||||
class PosixPathWrapper:
|
||||
def __init__(self, pathobj):
|
||||
self.pathobj = pathobj
|
||||
|
||||
@staticmethod
|
||||
def fixup_separators(path):
|
||||
if SCons.Platform.platform_default() == "win32":
|
||||
return path.replace(os.path.sep, os.path.altsep)
|
||||
return path
|
||||
|
||||
@staticmethod
|
||||
def fix_path(path):
|
||||
return str(PurePosixPath(Path(path).as_posix()))
|
||||
|
||||
def __call__(self, target, source, env, for_signature):
|
||||
if for_signature:
|
||||
return self.pathobj
|
||||
|
||||
return self.fix_path(env.subst(self.pathobj))
|
||||
|
||||
|
||||
def path_as_posix(path):
|
||||
if SCons.Platform.platform_default() == "win32":
|
||||
return path.replace(os.path.sep, os.path.altsep)
|
||||
|
||||
Reference in New Issue
Block a user