mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-24 01:28:11 -07:00
Merge branch 'dev' of https://github.com/flipperdevices/flipperzero-firmware into mntm-dev
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
|
||||
@@ -79,7 +83,35 @@ 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)
|
||||
return path
|
||||
|
||||
|
||||
def open_browser_action(target, source, env):
|
||||
if sys.platform == "darwin":
|
||||
subprocess.run(["open", source[0].abspath])
|
||||
else:
|
||||
webbrowser.open(source[0].abspath)
|
||||
|
||||
Reference in New Issue
Block a user