MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / _build_project_save_archive

Function _build_project_save_archive

Scripts/Settings.py:1006–1038  ·  view source on GitHub ↗
(archive_path)

Source from the content-addressed store, hash-verified

1004 """Runs a selected script/executable reliably (works with nested folders & spaces)."""
1005 try:
1006 abs_path = os.path.abspath(abs_path)
1007 if not os.path.isfile(abs_path):
1008 return None
1009
1010 workdir = os.path.dirname(abs_path) or os.getcwd()
1011
1012 # Decide how to run it
1013 if abs_path.endswith(".py"):
1014 cmd = ["python3", abs_path]
1015 elif abs_path.endswith(".sh") or abs_path.endswith(".bash"):
1016 cmd = ["bash", abs_path]
1017 elif os.access(abs_path, os.X_OK):
1018 cmd = [abs_path]
1019 else:
1020 return None
1021
1022 proc = subprocess.run(cmd, cwd=workdir)
1023 return proc.returncode
1024 except KeyboardInterrupt:
1025 return 130
1026
1027def get_termux_info():
1028 if shutil.which("termux-info"):
1029 out, _err = run_command_silent("termux-info -j")
1030 try:
1031 info = json.loads(out)
1032 termux_version = info.get("termux_version", info.get("app_version", "Unknown"))
1033 termux_api_version = info.get("termux_api_version", "Unknown")
1034 except Exception:
1035 termux_version = "Unknown"
1036 termux_api_version = "Unknown"
1037 else:
1038 termux_version = "Unknown"
1039 termux_api_version = "Unknown"
1040 termux_style_version = "Default"
1041 return termux_version, termux_api_version, termux_style_version

Callers 1

save_projectFunction · 0.70

Tested by

no test coverage detected