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

Function install_self

Scripts/Developer Base/Tree Explorer.py:1028–1053  ·  view source on GitHub ↗
(lang: str, alias: str = "supertree")

Source from the content-addressed store, hash-verified

1026
1027# ------------------ Installer (no root) ------------------
1028def install_self(lang: str, alias: str = "supertree") -> int:
1029 pref = termux_prefix()
1030 if not pref:
1031 print(t("install_err_prefix", lang), file=sys.stderr)
1032 return 1
1033
1034 bin_dir = pref / "bin"
1035 try:
1036 bin_dir.mkdir(parents=True, exist_ok=True)
1037 except Exception as e:
1038 print(t("install_err_bin", lang, path=bin_dir, err=e), file=sys.stderr)
1039 return 1
1040
1041 src = Path(__file__).resolve()
1042 dst = bin_dir / alias
1043
1044 try:
1045 dst.write_bytes(src.read_bytes())
1046 mode = dst.stat().st_mode
1047 dst.chmod(mode | 0o111)
1048 except Exception as e:
1049 print(t("install_err_failed", lang, err=e), file=sys.stderr)
1050 return 1
1051
1052 print(t("install_ok", lang, alias=alias))
1053 return 0
1054
1055
1056# ------------------ Explorer mode ------------------

Callers 2

menu_loopFunction · 0.70
mainFunction · 0.70

Calls 3

printFunction · 0.85
termux_prefixFunction · 0.70
tFunction · 0.70

Tested by

no test coverage detected