mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 20:49:49 +04:00
fbt/ufbt: Ensure POSIX paths are passed to GDB on all platforms
https://github.com/flipperdevices/flipperzero-firmware/pull/3360/files
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import webbrowser
|
||||
from pathlib import Path, PurePosixPath
|
||||
|
||||
import SCons
|
||||
from SCons.Errors import StopError
|
||||
@@ -80,6 +84,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