mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-07 03:05:18 +08:00
Update TermuxConstants
The `TermuxConstants` and `TermuxPropertyConstants` classes have both been updated to `v0.2.0`. Check their Changelog sections for info on changes. Some other hardcoded termux paths have been removed as well and are now referenced from `TermuxConstants` class.
This commit is contained in:
@@ -36,7 +36,7 @@ public final class BackgroundJob {
|
|||||||
|
|
||||||
public BackgroundJob(String cwd, String fileToExecute, final String[] args, final TermuxService service, PendingIntent pendingIntent) {
|
public BackgroundJob(String cwd, String fileToExecute, final String[] args, final TermuxService service, PendingIntent pendingIntent) {
|
||||||
String[] env = buildEnvironment(false, cwd);
|
String[] env = buildEnvironment(false, cwd);
|
||||||
if (cwd == null || cwd.isEmpty()) cwd = TermuxConstants.HOME_PATH;
|
if (cwd == null || cwd.isEmpty()) cwd = TermuxConstants.TERMUX_HOME_DIR_PATH;
|
||||||
|
|
||||||
final String[] progArray = setupProcessArgs(fileToExecute, args);
|
final String[] progArray = setupProcessArgs(fileToExecute, args);
|
||||||
final String processDescription = Arrays.toString(progArray);
|
final String processDescription = Arrays.toString(progArray);
|
||||||
@@ -134,17 +134,17 @@ public final class BackgroundJob {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static String[] buildEnvironment(boolean failSafe, String cwd) {
|
static String[] buildEnvironment(boolean failSafe, String cwd) {
|
||||||
new File(TermuxConstants.HOME_PATH).mkdirs();
|
TermuxConstants.TERMUX_HOME_DIR.mkdirs();
|
||||||
|
|
||||||
if (cwd == null || cwd.isEmpty()) cwd = TermuxConstants.HOME_PATH;
|
if (cwd == null || cwd.isEmpty()) cwd = TermuxConstants.TERMUX_HOME_DIR_PATH;
|
||||||
|
|
||||||
List<String> environment = new ArrayList<>();
|
List<String> environment = new ArrayList<>();
|
||||||
|
|
||||||
environment.add("TERMUX_VERSION=" + BuildConfig.VERSION_NAME);
|
environment.add("TERMUX_VERSION=" + BuildConfig.VERSION_NAME);
|
||||||
environment.add("TERM=xterm-256color");
|
environment.add("TERM=xterm-256color");
|
||||||
environment.add("COLORTERM=truecolor");
|
environment.add("COLORTERM=truecolor");
|
||||||
environment.add("HOME=" + TermuxConstants.HOME_PATH);
|
environment.add("HOME=" + TermuxConstants.TERMUX_HOME_DIR_PATH);
|
||||||
environment.add("PREFIX=" + TermuxConstants.PREFIX_PATH);
|
environment.add("PREFIX=" + TermuxConstants.TERMUX_PREFIX_DIR_PATH);
|
||||||
environment.add("BOOTCLASSPATH=" + System.getenv("BOOTCLASSPATH"));
|
environment.add("BOOTCLASSPATH=" + System.getenv("BOOTCLASSPATH"));
|
||||||
environment.add("ANDROID_ROOT=" + System.getenv("ANDROID_ROOT"));
|
environment.add("ANDROID_ROOT=" + System.getenv("ANDROID_ROOT"));
|
||||||
environment.add("ANDROID_DATA=" + System.getenv("ANDROID_DATA"));
|
environment.add("ANDROID_DATA=" + System.getenv("ANDROID_DATA"));
|
||||||
@@ -164,9 +164,9 @@ public final class BackgroundJob {
|
|||||||
environment.add("PATH= " + System.getenv("PATH"));
|
environment.add("PATH= " + System.getenv("PATH"));
|
||||||
} else {
|
} else {
|
||||||
environment.add("LANG=en_US.UTF-8");
|
environment.add("LANG=en_US.UTF-8");
|
||||||
environment.add("PATH=" + TermuxConstants.PREFIX_PATH + "/bin");
|
environment.add("PATH=" + TermuxConstants.TERMUX_BIN_PREFIX_DIR_PATH);
|
||||||
environment.add("PWD=" + cwd);
|
environment.add("PWD=" + cwd);
|
||||||
environment.add("TMPDIR=" + TermuxConstants.PREFIX_PATH + "/tmp");
|
environment.add("TMPDIR=" + TermuxConstants.TERMUX_TMP_PREFIX_DIR_PATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
return environment.toArray(new String[0]);
|
return environment.toArray(new String[0]);
|
||||||
@@ -215,7 +215,7 @@ public final class BackgroundJob {
|
|||||||
if (executable.startsWith("/usr") || executable.startsWith("/bin")) {
|
if (executable.startsWith("/usr") || executable.startsWith("/bin")) {
|
||||||
String[] parts = executable.split("/");
|
String[] parts = executable.split("/");
|
||||||
String binary = parts[parts.length - 1];
|
String binary = parts[parts.length - 1];
|
||||||
interpreter = TermuxConstants.PREFIX_PATH + "/bin/" + binary;
|
interpreter = TermuxConstants.TERMUX_BIN_PREFIX_DIR_PATH + "/" + binary;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -225,7 +225,7 @@ public final class BackgroundJob {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No shebang and no ELF, use standard shell.
|
// No shebang and no ELF, use standard shell.
|
||||||
interpreter = TermuxConstants.PREFIX_PATH + "/bin/sh";
|
interpreter = TermuxConstants.TERMUX_BIN_PREFIX_DIR_PATH + "/sh";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -184,9 +184,9 @@ public class RunCommandService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean allowExternalApps() {
|
private boolean allowExternalApps() {
|
||||||
File propsFile = new File(TermuxConstants.TERMUX_PROPERTIES_PRIMARY_PATH);
|
File propsFile = new File(TermuxConstants.TERMUX_PROPERTIES_PRIMARY_FILE_PATH);
|
||||||
if (!propsFile.exists())
|
if (!propsFile.exists())
|
||||||
propsFile = new File(TermuxConstants.TERMUX_PROPERTIES_SECONDARY_PATH);
|
propsFile = new File(TermuxConstants.TERMUX_PROPERTIES_SECONDARY_FILE_PATH);
|
||||||
|
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
try {
|
try {
|
||||||
@@ -205,10 +205,10 @@ public class RunCommandService extends Service {
|
|||||||
/** Replace "$PREFIX/" or "~/" prefix with termux absolute paths */
|
/** Replace "$PREFIX/" or "~/" prefix with termux absolute paths */
|
||||||
public static String getExpandedTermuxPath(String path) {
|
public static String getExpandedTermuxPath(String path) {
|
||||||
if(path != null && !path.isEmpty()) {
|
if(path != null && !path.isEmpty()) {
|
||||||
path = path.replaceAll("^\\$PREFIX$", TermuxConstants.PREFIX_PATH);
|
path = path.replaceAll("^\\$PREFIX$", TermuxConstants.TERMUX_PREFIX_DIR_PATH);
|
||||||
path = path.replaceAll("^\\$PREFIX/", TermuxConstants.PREFIX_PATH + "/");
|
path = path.replaceAll("^\\$PREFIX/", TermuxConstants.TERMUX_PREFIX_DIR_PATH + "/");
|
||||||
path = path.replaceAll("^~/$", TermuxConstants.HOME_PATH);
|
path = path.replaceAll("^~/$", TermuxConstants.TERMUX_HOME_DIR_PATH);
|
||||||
path = path.replaceAll("^~/", TermuxConstants.HOME_PATH + "/");
|
path = path.replaceAll("^~/", TermuxConstants.TERMUX_HOME_DIR_PATH + "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
@@ -167,8 +167,8 @@ public final class TermuxActivity extends Activity implements ServiceConnection
|
|||||||
|
|
||||||
void checkForFontAndColors() {
|
void checkForFontAndColors() {
|
||||||
try {
|
try {
|
||||||
File colorsFile = new File(TermuxConstants.COLOR_PROPERTIES_PATH);
|
File colorsFile = TermuxConstants.TERMUX_COLOR_PROPERTIES_FILE;
|
||||||
File fontFile = new File(TermuxConstants.FONT_PATH);
|
File fontFile = TermuxConstants.TERMUX_FONT_FILE;
|
||||||
|
|
||||||
final Properties props = new Properties();
|
final Properties props = new Properties();
|
||||||
if (colorsFile.isFile()) {
|
if (colorsFile.isFile()) {
|
||||||
|
@@ -4,13 +4,33 @@ import android.annotation.SuppressLint;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
// Version: v0.1.0
|
/*
|
||||||
|
* Version: v0.2.0
|
||||||
|
*
|
||||||
|
* Changelog
|
||||||
|
*
|
||||||
|
* - 0.1.0 (2021-03-08)
|
||||||
|
* - Initial Release.
|
||||||
|
*
|
||||||
|
* - 0.2.0 (2021-03-11)
|
||||||
|
* - Added `_DIR` and `_FILE` substrings to paths.
|
||||||
|
* - Add INTERNAL_PRIVATE_APP_DATA_DIR*, TERMUX_CACHE_DIR*, TERMUX_DATABASES_DIR*,
|
||||||
|
* TERMUX_SHARED_PREFERENCES_DIR*, TERMUX_BIN_PREFIX_DIR*, TERMUX_ETC_DIR*, TERMUX_INCLUDE_DIR*,
|
||||||
|
* TERMUX_LIB_DIR*, TERMUX_LIBEXEC_DIR*, TERMUX_SHARE_DIR*, TERMUX_TMP_DIR*, TERMUX_VAR_DIR*,
|
||||||
|
* TERMUX_STAGING_PREFIX_DIR*, TERMUX_STORAGE_HOME_DIR*, TERMUX_DEFAULT_PREFERENCES_FILE_BASENAME*,
|
||||||
|
* TERMUX_DEFAULT_PREFERENCES_FILE
|
||||||
|
* - Renamed `DATA_HOME_PATH` to `TERMUX_DATA_HOME_DIR_PATH`.
|
||||||
|
* - Renamed `CONFIG_HOME_PATH` to `TERMUX_CONFIG_HOME_DIR_PATH`.
|
||||||
|
* - Updated javadocs and spacing.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class that defines shared constants of the Termux app and its plugins.
|
* A class that defines shared constants of the Termux app and its plugins.
|
||||||
* This class will be hosted by termux-app and should be imported by other termux plugin apps as is
|
* This class will be hosted by termux-app and should be imported by other termux plugin apps as is
|
||||||
* instead of copying constants to random classes. The 3rd party apps can also import it for
|
* instead of copying constants to random classes. The 3rd party apps can also import it for
|
||||||
* interacting with termux apps.
|
* interacting with termux apps. If changes are made to this file, increment the version number
|
||||||
|
* and add an entry in the Changelog section above.
|
||||||
*
|
*
|
||||||
* Termux app default package name is "com.termux" and is used in PREFIX_PATH.
|
* Termux app default package name is "com.termux" and is used in PREFIX_PATH.
|
||||||
* The binaries compiled for termux have PREFIX_PATH hardcoded in them but it can be changed during
|
* The binaries compiled for termux have PREFIX_PATH hardcoded in them but it can be changed during
|
||||||
@@ -39,175 +59,348 @@ import java.io.File;
|
|||||||
* TERMUX_PACKAGE_NAME must be used in source code of Termux app and its plugins instead of hardcoded
|
* TERMUX_PACKAGE_NAME must be used in source code of Termux app and its plugins instead of hardcoded
|
||||||
* "com.termux" paths.
|
* "com.termux" paths.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public final class TermuxConstants {
|
public final class TermuxConstants {
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Termux app and plugin app and package names.
|
* Termux and its plugin app and package names.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** Termux app name */
|
||||||
public static final String TERMUX_APP_NAME = "Termux"; // Default: "Termux"
|
public static final String TERMUX_APP_NAME = "Termux"; // Default: "Termux"
|
||||||
|
/** Termux app package name */
|
||||||
public static final String TERMUX_PACKAGE_NAME = "com.termux"; // Default: "com.termux"
|
public static final String TERMUX_PACKAGE_NAME = "com.termux"; // Default: "com.termux"
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux API app name */
|
||||||
public static final String TERMUX_API_APP_NAME = "Termux:API"; // Default: "Termux:API"
|
public static final String TERMUX_API_APP_NAME = "Termux:API"; // Default: "Termux:API"
|
||||||
|
/** Termux API app package name */
|
||||||
public static final String TERMUX_API_PACKAGE_NAME = TERMUX_PACKAGE_NAME + ".api"; // Default: "com.termux.api"
|
public static final String TERMUX_API_PACKAGE_NAME = TERMUX_PACKAGE_NAME + ".api"; // Default: "com.termux.api"
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux Boot app name */
|
||||||
public static final String TERMUX_BOOT_APP_NAME = "Termux:Boot"; // Default: "Termux:Boot"
|
public static final String TERMUX_BOOT_APP_NAME = "Termux:Boot"; // Default: "Termux:Boot"
|
||||||
|
/** Termux Boot app package name */
|
||||||
public static final String TERMUX_BOOT_PACKAGE_NAME = TERMUX_PACKAGE_NAME + ".boot"; // Default: "com.termux.boot"
|
public static final String TERMUX_BOOT_PACKAGE_NAME = TERMUX_PACKAGE_NAME + ".boot"; // Default: "com.termux.boot"
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux Float app name */
|
||||||
public static final String TERMUX_FLOAT_APP_NAME = "Termux:Float"; // Default: "Termux:Float"
|
public static final String TERMUX_FLOAT_APP_NAME = "Termux:Float"; // Default: "Termux:Float"
|
||||||
|
/** Termux Float app package name */
|
||||||
public static final String TERMUX_FLOAT_PACKAGE_NAME = TERMUX_PACKAGE_NAME + ".window"; // Default: "com.termux.window"
|
public static final String TERMUX_FLOAT_PACKAGE_NAME = TERMUX_PACKAGE_NAME + ".window"; // Default: "com.termux.window"
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux Styling app name */
|
||||||
public static final String TERMUX_STYLING_APP_NAME = "Termux:Styling"; // Default: "Termux:Styling"
|
public static final String TERMUX_STYLING_APP_NAME = "Termux:Styling"; // Default: "Termux:Styling"
|
||||||
|
/** Termux Styling app package name */
|
||||||
public static final String TERMUX_STYLING_PACKAGE_NAME = TERMUX_PACKAGE_NAME + ".styling"; // Default: "com.termux.styling"
|
public static final String TERMUX_STYLING_PACKAGE_NAME = TERMUX_PACKAGE_NAME + ".styling"; // Default: "com.termux.styling"
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux Plugin app name */
|
||||||
public static final String TERMUX_TASKER_APP_NAME = "Termux:Tasker"; // Default: "Termux:Tasker"
|
public static final String TERMUX_TASKER_APP_NAME = "Termux:Tasker"; // Default: "Termux:Tasker"
|
||||||
|
/** Termux Plugin app package name */
|
||||||
public static final String TERMUX_TASKER_PACKAGE_NAME = TERMUX_PACKAGE_NAME + ".tasker"; // Default: "com.termux.tasker"
|
public static final String TERMUX_TASKER_PACKAGE_NAME = TERMUX_PACKAGE_NAME + ".tasker"; // Default: "com.termux.tasker"
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux Widget app name */
|
||||||
public static final String TERMUX_WIDGET_APP_NAME = "Termux:Widget"; // Default: "Termux:Widget"
|
public static final String TERMUX_WIDGET_APP_NAME = "Termux:Widget"; // Default: "Termux:Widget"
|
||||||
|
/** Termux Widget app package name */
|
||||||
public static final String TERMUX_WIDGET_PACKAGE_NAME = TERMUX_PACKAGE_NAME + ".widget"; // Default: "com.termux.widget"
|
public static final String TERMUX_WIDGET_PACKAGE_NAME = TERMUX_PACKAGE_NAME + ".widget"; // Default: "com.termux.widget"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Termux app core paths.
|
|
||||||
|
/*
|
||||||
|
* Termux app core directory paths.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** Termux app internal private app data directory path */
|
||||||
@SuppressLint("SdCardPath")
|
@SuppressLint("SdCardPath")
|
||||||
public static final String FILES_PATH = "/data/data/" + TERMUX_PACKAGE_NAME + "/files"; // Default: "/data/data/com.termux/files"
|
public static final String INTERNAL_PRIVATE_APP_DATA_DIR_PATH = "/data/data/" + TERMUX_PACKAGE_NAME; // Default: "/data/data/com.termux"
|
||||||
public static final String PREFIX_PATH = FILES_PATH + "/usr"; // Termux $PREFIX path. Default: "/data/data/com.termux/files/usr"
|
/** Termux app internal private app data directory */
|
||||||
public static final String HOME_PATH = FILES_PATH + "/home"; // Termux $HOME path. Default: "/data/data/com.termux/files/home"
|
public static final File INTERNAL_PRIVATE_APP_DATA_DIR = new File(INTERNAL_PRIVATE_APP_DATA_DIR_PATH);
|
||||||
public static final String DATA_HOME_PATH = HOME_PATH + "/.termux"; // Default: "/data/data/com.termux/files/home/.termux"
|
|
||||||
public static final String CONFIG_HOME_PATH = HOME_PATH + "/.config/termux"; // Default: "/data/data/com.termux/files/home/.config/termux"
|
|
||||||
|
/** Termux app cache directory path */
|
||||||
|
public static final String TERMUX_CACHE_DIR_PATH = INTERNAL_PRIVATE_APP_DATA_DIR_PATH + "/cache"; // Default: "/data/data/com.termux/cache"
|
||||||
|
/** Termux app cache directory */
|
||||||
|
public static final File TERMUX_CACHE_DIR = new File(TERMUX_CACHE_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app database directory path */
|
||||||
|
public static final String TERMUX_DATABASES_DIR_PATH = INTERNAL_PRIVATE_APP_DATA_DIR_PATH + "/databases"; // Default: "/data/data/com.termux/databases"
|
||||||
|
/** Termux app database directory */
|
||||||
|
public static final File TERMUX_DATABASES_DIR = new File(TERMUX_DATABASES_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app shared preferences directory path */
|
||||||
|
public static final String TERMUX_SHARED_PREFERENCES_DIR_PATH = INTERNAL_PRIVATE_APP_DATA_DIR_PATH + "/shared_prefs"; // Default: "/data/data/com.termux/shared_prefs"
|
||||||
|
/** Termux app shared preferences directory */
|
||||||
|
public static final File TERMUX_SHARED_PREFERENCES_DIR = new File(TERMUX_SHARED_PREFERENCES_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app Files directory path */
|
||||||
|
public static final String TERMUX_FILES_DIR_PATH = INTERNAL_PRIVATE_APP_DATA_DIR_PATH + "/files"; // Default: "/data/data/com.termux/files"
|
||||||
|
/** Termux app Files directory */
|
||||||
|
public static final File TERMUX_FILES_DIR = new File(TERMUX_FILES_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/** Termux app $PREFIX directory path */
|
||||||
|
public static final String TERMUX_PREFIX_DIR_PATH = TERMUX_FILES_DIR_PATH + "/usr"; // Default: "/data/data/com.termux/files/usr"
|
||||||
|
/** Termux app $PREFIX directory */
|
||||||
|
public static final File TERMUX_PREFIX_DIR = new File(TERMUX_PREFIX_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app $PREFIX/bin directory path */
|
||||||
|
public static final String TERMUX_BIN_PREFIX_DIR_PATH = TERMUX_PREFIX_DIR_PATH + "/bin"; // Default: "/data/data/com.termux/files/usr/bin"
|
||||||
|
/** Termux app $PREFIX/bin directory */
|
||||||
|
public static final File TERMUX_BIN_PREFIX_DIR = new File(TERMUX_BIN_PREFIX_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app $PREFIX/etc directory path */
|
||||||
|
public static final String TERMUX_ETC_PREFIX_DIR_PATH = TERMUX_PREFIX_DIR_PATH + "/etc"; // Default: "/data/data/com.termux/files/usr/etc"
|
||||||
|
/** Termux app $PREFIX/etc directory */
|
||||||
|
public static final File TERMUX_ETC_DIR = new File(TERMUX_ETC_PREFIX_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app $PREFIX/include directory path */
|
||||||
|
public static final String TERMUX_INCLUDE_PREFIX_DIR_PATH = TERMUX_PREFIX_DIR_PATH + "/include"; // Default: "/data/data/com.termux/files/usr/include"
|
||||||
|
/** Termux app $PREFIX/include directory */
|
||||||
|
public static final File TERMUX_INCLUDE_DIR = new File(TERMUX_INCLUDE_PREFIX_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app $PREFIX/lib directory path */
|
||||||
|
public static final String TERMUX_LIB_PREFIX_DIR_PATH = TERMUX_PREFIX_DIR_PATH + "/lib"; // Default: "/data/data/com.termux/files/usr/lib"
|
||||||
|
/** Termux app $PREFIX/lib directory */
|
||||||
|
public static final File TERMUX_LIB_DIR = new File(TERMUX_LIB_PREFIX_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app $PREFIX/libexec directory path */
|
||||||
|
public static final String TERMUX_LIBEXEC_PREFIX_DIR_PATH = TERMUX_PREFIX_DIR_PATH + "/libexec"; // Default: "/data/data/com.termux/files/usr/libexec"
|
||||||
|
/** Termux app $PREFIX/libexec directory */
|
||||||
|
public static final File TERMUX_LIBEXEC_DIR = new File(TERMUX_LIBEXEC_PREFIX_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app $PREFIX/share directory path */
|
||||||
|
public static final String TERMUX_SHARE_PREFIX_DIR_PATH = TERMUX_PREFIX_DIR_PATH + "/share"; // Default: "/data/data/com.termux/files/usr/share"
|
||||||
|
/** Termux app $PREFIX/share directory */
|
||||||
|
public static final File TERMUX_SHARE_DIR = new File(TERMUX_SHARE_PREFIX_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app $PREFIX/tmp and $TMP directory path */
|
||||||
|
public static final String TERMUX_TMP_PREFIX_DIR_PATH = TERMUX_PREFIX_DIR_PATH + "/tmp"; // Default: "/data/data/com.termux/files/usr/tmp"
|
||||||
|
/** Termux app $PREFIX/tmp and $TMP directory */
|
||||||
|
public static final File TERMUX_TMP_DIR = new File(TERMUX_TMP_PREFIX_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app $PREFIX/var directory path */
|
||||||
|
public static final String TERMUX_VAR_PREFIX_DIR_PATH = TERMUX_PREFIX_DIR_PATH + "/var"; // Default: "/data/data/com.termux/files/usr/var"
|
||||||
|
/** Termux app $PREFIX/var directory */
|
||||||
|
public static final File TERMUX_VAR_DIR = new File(TERMUX_VAR_PREFIX_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app usr-staging directory path */
|
||||||
|
public static final String TERMUX_STAGING_PREFIX_DIR_PATH = TERMUX_FILES_DIR_PATH + "/usr-staging"; // Default: "/data/data/com.termux/files/usr-staging"
|
||||||
|
/** Termux app usr-staging directory */
|
||||||
|
public static final File TERMUX_STAGING_PREFIX_DIR = new File(TERMUX_STAGING_PREFIX_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app $HOME directory path */
|
||||||
|
public static final String TERMUX_HOME_DIR_PATH = TERMUX_FILES_DIR_PATH + "/home"; // Default: "/data/data/com.termux/files/home"
|
||||||
|
/** Termux app $HOME directory */
|
||||||
|
public static final File TERMUX_HOME_DIR = new File(TERMUX_HOME_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app config home directory path */
|
||||||
|
public static final String TERMUX_CONFIG_HOME_DIR_PATH = TERMUX_HOME_DIR_PATH + "/.config/termux"; // Default: "/data/data/com.termux/files/home/.config/termux"
|
||||||
|
/** Termux app config home directory */
|
||||||
|
public static final File TERMUX_CONFIG_HOME_DIR = new File(TERMUX_CONFIG_HOME_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app data home directory path */
|
||||||
|
public static final String TERMUX_DATA_HOME_DIR_PATH = TERMUX_HOME_DIR_PATH + "/.termux"; // Default: "/data/data/com.termux/files/home/.termux"
|
||||||
|
/** Termux app data home directory */
|
||||||
|
public static final File TERMUX_DATA_HOME_DIR = new File(TERMUX_DATA_HOME_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app storage home directory path */
|
||||||
|
public static final String TERMUX_STORAGE_HOME_DIR_PATH = TERMUX_HOME_DIR_PATH + "/storage"; // Default: "/data/data/com.termux/files/home/storage"
|
||||||
|
/** Termux app storage home directory */
|
||||||
|
public static final File TERMUX_STORAGE_HOME_DIR = new File(TERMUX_STORAGE_HOME_DIR_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Termux app core file paths.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Termux app default SharedPreferences file basename */
|
||||||
|
public static final String TERMUX_DEFAULT_PREFERENCES_FILE_BASENAME = TERMUX_PACKAGE_NAME + "_preferences.xml"; // Default: "com.termux_preferences.xml"
|
||||||
|
|
||||||
|
/* Termux app default SharedPreferences file path */
|
||||||
|
public static final String TERMUX_DEFAULT_PREFERENCES_FILE_PATH = TERMUX_SHARED_PREFERENCES_DIR_PATH + "/" + TERMUX_DEFAULT_PREFERENCES_FILE_BASENAME; // Default: "/data/data/com.termux/shared_prefs/com.termux_preferences.xml"
|
||||||
|
/* Termux app default SharedPreferences file */
|
||||||
|
public static final File TERMUX_DEFAULT_PREFERENCES_FILE = new File(TERMUX_DEFAULT_PREFERENCES_FILE_PATH);
|
||||||
|
|
||||||
|
/* Termux app termux.properties primary file path */
|
||||||
|
public static final String TERMUX_PROPERTIES_PRIMARY_FILE_PATH = TERMUX_DATA_HOME_DIR_PATH + "/termux.properties"; // Default: "/data/data/com.termux/files/home/.termux/termux.properties"
|
||||||
|
/* Termux app termux.properties primary file */
|
||||||
|
public static final File TERMUX_PROPERTIES_PRIMARY_FILE = new File(TERMUX_PROPERTIES_PRIMARY_FILE_PATH);
|
||||||
|
|
||||||
|
/* Termux app termux.properties secondary file path */
|
||||||
|
public static final String TERMUX_PROPERTIES_SECONDARY_FILE_PATH = TERMUX_CONFIG_HOME_DIR_PATH + "/termux.properties"; // Default: "/data/data/com.termux/files/home/.config/termux/termux.properties"
|
||||||
|
/* Termux app termux.properties secondary file */
|
||||||
|
public static final File TERMUX_PROPERTIES_SECONDARY_FILE = new File(TERMUX_PROPERTIES_SECONDARY_FILE_PATH);
|
||||||
|
|
||||||
|
/* Termux app and Termux:Styling colors.properties file path */
|
||||||
|
public static final String TERMUX_COLOR_PROPERTIES_FILE_PATH = TERMUX_DATA_HOME_DIR_PATH + "/colors.properties"; // Default: "/data/data/com.termux/files/home/.termux/colors.properties"
|
||||||
|
/* Termux app and Termux:Styling colors.properties file */
|
||||||
|
public static final File TERMUX_COLOR_PROPERTIES_FILE = new File(TERMUX_COLOR_PROPERTIES_FILE_PATH);
|
||||||
|
|
||||||
|
/* Termux app and Termux:Styling font.ttf file path */
|
||||||
|
public static final String TERMUX_FONT_FILE_PATH = TERMUX_DATA_HOME_DIR_PATH + "/font.ttf"; // Default: "/data/data/com.termux/files/home/.termux/font.ttf"
|
||||||
|
/* Termux app and Termux:Styling font.ttf file */
|
||||||
|
public static final File TERMUX_FONT_FILE = new File(TERMUX_FONT_FILE_PATH);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
* Termux app plugin specific paths.
|
* Termux app plugin specific paths.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Path to store scripts to be run at boot by Termux:Boot
|
/* Termux app directory path to store scripts to be run at boot by Termux:Boot */
|
||||||
public static final String BOOT_SCRIPTS_PATH = DATA_HOME_PATH + "/boot"; // Default: "/data/data/com.termux/files/home/.termux/boot"
|
public static final String TERMUX_BOOT_SCRIPTS_DIR_PATH = TERMUX_DATA_HOME_DIR_PATH + "/boot"; // Default: "/data/data/com.termux/files/home/.termux/boot"
|
||||||
|
/* Termux app directory to store scripts to be run at boot by Termux:Boot */
|
||||||
|
public static final File TERMUX_BOOT_SCRIPTS_DIR = new File(TERMUX_BOOT_SCRIPTS_DIR_PATH);
|
||||||
|
|
||||||
// Path to store foreground scripts that can be run by the termux launcher widget provided by Termux:Widget
|
|
||||||
public static final String SHORTCUT_SCRIPTS_PATH = DATA_HOME_PATH + "/shortcuts"; // Default: "/data/data/com.termux/files/home/.termux/shortcuts"
|
|
||||||
|
|
||||||
// Path to store background scripts that can be run by the termux launcher widget provided by Termux:Widget
|
/* Termux app directory path to store foreground scripts that can be run by the termux launcher widget provided by Termux:Widget */
|
||||||
public static final String SHORTCUT_TASKS_SCRIPTS_PATH = DATA_HOME_PATH + "/shortcuts/tasks"; // Default: "/data/data/com.termux/files/home/.termux/shortcuts/tasks"
|
public static final String TERMUX_SHORTCUT_SCRIPTS_DIR_PATH = TERMUX_DATA_HOME_DIR_PATH + "/shortcuts"; // Default: "/data/data/com.termux/files/home/.termux/shortcuts"
|
||||||
|
/* Termux app directory to store foreground scripts that can be run by the termux launcher widget provided by Termux:Widget */
|
||||||
|
public static final File TERMUX_SHORTCUT_SCRIPTS_DIR = new File(TERMUX_SHORTCUT_SCRIPTS_DIR_PATH);
|
||||||
|
|
||||||
// Path to store scripts to be run by 3rd party twofortyfouram locale plugin host apps like Tasker app via the Termux:Tasker plugin client
|
|
||||||
public static final String TASKER_SCRIPTS_PATH = DATA_HOME_PATH + "/tasker"; // Default: "/data/data/com.termux/files/home/.termux/tasker"
|
|
||||||
|
|
||||||
// Termux app termux.properties primary path
|
/* Termux app directory path to store background scripts that can be run by the termux launcher widget provided by Termux:Widget */
|
||||||
public static final String TERMUX_PROPERTIES_PRIMARY_PATH = DATA_HOME_PATH + "/termux.properties"; // Default: "/data/data/com.termux/files/home/.termux/termux.properties"
|
public static final String TERMUX_SHORTCUT_TASKS_SCRIPTS_DIR_PATH = TERMUX_DATA_HOME_DIR_PATH + "/shortcuts/tasks"; // Default: "/data/data/com.termux/files/home/.termux/shortcuts/tasks"
|
||||||
|
/* Termux app directory to store background scripts that can be run by the termux launcher widget provided by Termux:Widget */
|
||||||
|
public static final File TERMUX_SHORTCUT_TASKS_SCRIPTS_DIR = new File(TERMUX_SHORTCUT_TASKS_SCRIPTS_DIR_PATH);
|
||||||
|
|
||||||
// Termux app termux.properties secondary path
|
|
||||||
public static final String TERMUX_PROPERTIES_SECONDARY_PATH = CONFIG_HOME_PATH + "/termux.properties"; // Default: "/data/data/com.termux/files/home/.config/termux/termux.properties"
|
|
||||||
|
|
||||||
// Termux app and Termux:Styling colors.properties path
|
/* Termux app directory path to store scripts to be run by 3rd party twofortyfouram locale plugin host apps like Tasker app via the Termux:Tasker plugin client */
|
||||||
public static final String COLOR_PROPERTIES_PATH = DATA_HOME_PATH + "/colors.properties"; // Default: "/data/data/com.termux/files/home/.termux/colors.properties"
|
public static final String TERMUX_TASKER_SCRIPTS_DIR_PATH = TERMUX_DATA_HOME_DIR_PATH + "/tasker"; // Default: "/data/data/com.termux/files/home/.termux/tasker"
|
||||||
|
/* Termux app directory to store scripts to be run by 3rd party twofortyfouram locale plugin host apps like Tasker app via the Termux:Tasker plugin client */
|
||||||
// Termux app and Termux:Styling font.ttf path
|
public static final File TERMUX_TASKER_SCRIPTS_DIR = new File(TERMUX_TASKER_SCRIPTS_DIR_PATH);
|
||||||
public static final String FONT_PATH = DATA_HOME_PATH + "/font.ttf"; // Default: "/data/data/com.termux/files/home/.termux/font.ttf"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Termux app plugin specific path File objects.
|
|
||||||
|
/*
|
||||||
|
* Termux app and plugins miscellaneous variables.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static final File FILES_DIR = new File(FILES_PATH);
|
/* Android OS permission declared by Termux app in AndroidManifest.xml which can be requested by 3rd party apps to run various commands in Termux app context */
|
||||||
public static final File PREFIX_DIR = new File(PREFIX_PATH);
|
|
||||||
public static final File HOME_DIR = new File(HOME_PATH);
|
|
||||||
public static final File DATA_HOME_DIR = new File(DATA_HOME_PATH);
|
|
||||||
public static final File CONFIG_HOME_DIR = new File(CONFIG_HOME_PATH);
|
|
||||||
public static final File BOOT_SCRIPTS_DIR = new File(BOOT_SCRIPTS_PATH);
|
|
||||||
public static final File SHORTCUT_SCRIPTS_DIR = new File(SHORTCUT_SCRIPTS_PATH);
|
|
||||||
public static final File SHORTCUT_TASKS_SCRIPTS_DIR = new File(SHORTCUT_TASKS_SCRIPTS_PATH);
|
|
||||||
public static final File TASKER_SCRIPTS_DIR = new File(TASKER_SCRIPTS_PATH);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Android OS permission declared by Termux app in AndroidManifest.xml which can be requested by 3rd party apps to run various commands in Termux app context
|
|
||||||
public static final String PERMISSION_RUN_COMMAND = TERMUX_PACKAGE_NAME + ".permission.RUN_COMMAND"; // Default: "com.termux.permission.RUN_COMMAND"
|
public static final String PERMISSION_RUN_COMMAND = TERMUX_PACKAGE_NAME + ".permission.RUN_COMMAND"; // Default: "com.termux.permission.RUN_COMMAND"
|
||||||
|
|
||||||
// Termux property defined in termux.properties file as a secondary check to PERMISSION_RUN_COMMAND to allow 3rd party apps to run various commands in Termux app context
|
/* Termux property defined in termux.properties file as a secondary check to PERMISSION_RUN_COMMAND to allow 3rd party apps to run various commands in Termux app context */
|
||||||
public static final String PROP_ALLOW_EXTERNAL_APPS = "allow-external-apps"; // Default: "allow-external-apps"
|
public static final String PROP_ALLOW_EXTERNAL_APPS = "allow-external-apps"; // Default: "allow-external-apps"
|
||||||
|
/* Default value for {@link #PROP_ALLOW_EXTERNAL_APPS} */
|
||||||
public static final String PROP_DEFAULT_VALUE_ALLOW_EXTERNAL_APPS = "false"; // Default: "false"
|
public static final String PROP_DEFAULT_VALUE_ALLOW_EXTERNAL_APPS = "false"; // Default: "false"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Termux app constants.
|
* Termux app constants.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static final class TERMUX_APP {
|
public static final class TERMUX_APP {
|
||||||
|
|
||||||
|
/** Termux app core activity name. */
|
||||||
|
public static final String TERMUX_ACTIVITY_NAME = TERMUX_PACKAGE_NAME + ".app.TermuxActivity"; // Default: "com.termux.app.TermuxActivity"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Termux app core activity.
|
* Termux app core activity.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static final String TERMUX_ACTIVITY_NAME = TERMUX_PACKAGE_NAME + ".app.TermuxActivity"; // Default: "com.termux.app.TermuxActivity"
|
|
||||||
public static final class TERMUX_ACTIVITY {
|
public static final class TERMUX_ACTIVITY {
|
||||||
|
|
||||||
// Intent action to start termux failsafe session
|
/* Intent action to start termux failsafe session */
|
||||||
public static final String ACTION_FAILSAFE_SESSION = TermuxConstants.TERMUX_PACKAGE_NAME + ".app.failsafe_session"; // Default: "com.termux.app.failsafe_session"
|
public static final String ACTION_FAILSAFE_SESSION = TermuxConstants.TERMUX_PACKAGE_NAME + ".app.failsafe_session"; // Default: "com.termux.app.failsafe_session"
|
||||||
|
|
||||||
// Intent action to make termux reload its termux session styling
|
|
||||||
|
/* Intent action to make termux reload its termux session styling */
|
||||||
public static final String ACTION_RELOAD_STYLE = TermuxConstants.TERMUX_PACKAGE_NAME + ".app.reload_style"; // Default: "com.termux.app.reload_style"
|
public static final String ACTION_RELOAD_STYLE = TermuxConstants.TERMUX_PACKAGE_NAME + ".app.reload_style"; // Default: "com.termux.app.reload_style"
|
||||||
// Intent extra for what to reload for the TERMUX_ACTIVITY.ACTION_RELOAD_STYLE intent
|
/* Intent extra for what to reload for the TERMUX_ACTIVITY.ACTION_RELOAD_STYLE intent */
|
||||||
public static final String EXTRA_RELOAD_STYLE = TermuxConstants.TERMUX_PACKAGE_NAME + ".app.reload_style"; // Default: "com.termux.app.reload_style"
|
public static final String EXTRA_RELOAD_STYLE = TermuxConstants.TERMUX_PACKAGE_NAME + ".app.reload_style"; // Default: "com.termux.app.reload_style"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app core service name. */
|
||||||
|
public static final String TERMUX_SERVICE_NAME = TERMUX_PACKAGE_NAME + ".app.TermuxService"; // Default: "com.termux.app.TermuxService"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Termux app core service.
|
* Termux app core service.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static final String TERMUX_SERVICE_NAME = TERMUX_PACKAGE_NAME + ".app.TermuxService"; // Default: "com.termux.app.TermuxService"
|
|
||||||
public static final class TERMUX_SERVICE {
|
public static final class TERMUX_SERVICE {
|
||||||
|
|
||||||
// Intent action to stop TERMUX_SERVICE
|
/* Intent action to stop TERMUX_SERVICE */
|
||||||
public static final String ACTION_STOP_SERVICE = TERMUX_PACKAGE_NAME + ".service_stop"; // Default: "com.termux.service_stop"
|
public static final String ACTION_STOP_SERVICE = TERMUX_PACKAGE_NAME + ".service_stop"; // Default: "com.termux.service_stop"
|
||||||
|
|
||||||
// Intent action to make TERMUX_SERVICE acquire a wakelock
|
|
||||||
|
/* Intent action to make TERMUX_SERVICE acquire a wakelock */
|
||||||
public static final String ACTION_WAKE_LOCK = TERMUX_PACKAGE_NAME + ".service_wake_lock"; // Default: "com.termux.service_wake_lock"
|
public static final String ACTION_WAKE_LOCK = TERMUX_PACKAGE_NAME + ".service_wake_lock"; // Default: "com.termux.service_wake_lock"
|
||||||
|
|
||||||
// Intent action to make TERMUX_SERVICE release wakelock
|
|
||||||
|
/* Intent action to make TERMUX_SERVICE release wakelock */
|
||||||
public static final String ACTION_WAKE_UNLOCK = TERMUX_PACKAGE_NAME + ".service_wake_unlock"; // Default: "com.termux.service_wake_unlock"
|
public static final String ACTION_WAKE_UNLOCK = TERMUX_PACKAGE_NAME + ".service_wake_unlock"; // Default: "com.termux.service_wake_unlock"
|
||||||
|
|
||||||
// Intent action to execute command with TERMUX_SERVICE
|
|
||||||
|
/* Intent action to execute command with TERMUX_SERVICE */
|
||||||
public static final String ACTION_SERVICE_EXECUTE = TERMUX_PACKAGE_NAME + ".service_execute"; // Default: "com.termux.service_execute"
|
public static final String ACTION_SERVICE_EXECUTE = TERMUX_PACKAGE_NAME + ".service_execute"; // Default: "com.termux.service_execute"
|
||||||
// Uri scheme for paths sent via intent to TERMUX_SERVICE
|
/* Uri scheme for paths sent via intent to TERMUX_SERVICE */
|
||||||
public static final String URI_SCHEME_SERVICE_EXECUTE = TERMUX_PACKAGE_NAME + ".file"; // Default: "com.termux.file"
|
public static final String URI_SCHEME_SERVICE_EXECUTE = TERMUX_PACKAGE_NAME + ".file"; // Default: "com.termux.file"
|
||||||
// Intent extra for command arguments for the TERMUX_SERVICE.ACTION_SERVICE_EXECUTE intent
|
/* Intent extra for command arguments for the TERMUX_SERVICE.ACTION_SERVICE_EXECUTE intent */
|
||||||
public static final String EXTRA_ARGUMENTS = TERMUX_PACKAGE_NAME + ".execute.arguments"; // Default: "com.termux.execute.arguments"
|
public static final String EXTRA_ARGUMENTS = TERMUX_PACKAGE_NAME + ".execute.arguments"; // Default: "com.termux.execute.arguments"
|
||||||
// Intent extra for command current working directory for the TERMUX_SERVICE.ACTION_SERVICE_EXECUTE intent
|
/* Intent extra for command current working directory for the TERMUX_SERVICE.ACTION_SERVICE_EXECUTE intent */
|
||||||
public static final String EXTRA_WORKDIR = TERMUX_PACKAGE_NAME + ".execute.cwd"; // Default: "com.termux.execute.cwd"
|
public static final String EXTRA_WORKDIR = TERMUX_PACKAGE_NAME + ".execute.cwd"; // Default: "com.termux.execute.cwd"
|
||||||
// Intent extra for command background mode for the TERMUX_SERVICE.ACTION_SERVICE_EXECUTE intent
|
/* Intent extra for command background mode for the TERMUX_SERVICE.ACTION_SERVICE_EXECUTE intent */
|
||||||
public static final String EXTRA_BACKGROUND = TERMUX_PACKAGE_NAME + ".execute.background"; // Default: "com.termux.execute.background"
|
public static final String EXTRA_BACKGROUND = TERMUX_PACKAGE_NAME + ".execute.background"; // Default: "com.termux.execute.background"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Termux app service to receive commands sent by 3rd party apps.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
/** Termux app run command service name. */
|
||||||
public static final String RUN_COMMAND_SERVICE_NAME = TERMUX_PACKAGE_NAME + ".app.RunCommandService"; // Termux app service to receive commands from 3rd party apps "com.termux.app.RunCommandService"
|
public static final String RUN_COMMAND_SERVICE_NAME = TERMUX_PACKAGE_NAME + ".app.RunCommandService"; // Termux app service to receive commands from 3rd party apps "com.termux.app.RunCommandService"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Termux app run command service to receive commands sent by 3rd party apps.
|
||||||
|
*/
|
||||||
public static final class RUN_COMMAND_SERVICE {
|
public static final class RUN_COMMAND_SERVICE {
|
||||||
|
|
||||||
// Intent action to execute command with RUN_COMMAND_SERVICE
|
/* Intent action to execute command with RUN_COMMAND_SERVICE */
|
||||||
public static final String ACTION_RUN_COMMAND = TERMUX_PACKAGE_NAME + ".RUN_COMMAND"; // Default: "com.termux.RUN_COMMAND"
|
public static final String ACTION_RUN_COMMAND = TERMUX_PACKAGE_NAME + ".RUN_COMMAND"; // Default: "com.termux.RUN_COMMAND"
|
||||||
// Intent extra for command path for the RUN_COMMAND_SERVICE.ACTION_RUN_COMMAND intent
|
/* Intent extra for command path for the RUN_COMMAND_SERVICE.ACTION_RUN_COMMAND intent */
|
||||||
public static final String EXTRA_COMMAND_PATH = TERMUX_PACKAGE_NAME + ".RUN_COMMAND_PATH"; // Default: "com.termux.RUN_COMMAND_PATH"
|
public static final String EXTRA_COMMAND_PATH = TERMUX_PACKAGE_NAME + ".RUN_COMMAND_PATH"; // Default: "com.termux.RUN_COMMAND_PATH"
|
||||||
// Intent extra for command arguments for the RUN_COMMAND_SERVICE.ACTION_RUN_COMMAND intent
|
/* Intent extra for command arguments for the RUN_COMMAND_SERVICE.ACTION_RUN_COMMAND intent */
|
||||||
public static final String EXTRA_ARGUMENTS = TERMUX_PACKAGE_NAME + ".RUN_COMMAND_ARGUMENTS"; // Default: "com.termux.RUN_COMMAND_ARGUMENTS"
|
public static final String EXTRA_ARGUMENTS = TERMUX_PACKAGE_NAME + ".RUN_COMMAND_ARGUMENTS"; // Default: "com.termux.RUN_COMMAND_ARGUMENTS"
|
||||||
// Intent extra for command current working directory for the RUN_COMMAND_SERVICE.ACTION_RUN_COMMAND intent
|
/* Intent extra for command current working directory for the RUN_COMMAND_SERVICE.ACTION_RUN_COMMAND intent */
|
||||||
public static final String EXTRA_WORKDIR = TERMUX_PACKAGE_NAME + ".RUN_COMMAND_WORKDIR"; // Default: "com.termux.RUN_COMMAND_WORKDIR"
|
public static final String EXTRA_WORKDIR = TERMUX_PACKAGE_NAME + ".RUN_COMMAND_WORKDIR"; // Default: "com.termux.RUN_COMMAND_WORKDIR"
|
||||||
// Intent extra for command background mode for the RUN_COMMAND_SERVICE.ACTION_RUN_COMMAND intent
|
/* Intent extra for command background mode for the RUN_COMMAND_SERVICE.ACTION_RUN_COMMAND intent */
|
||||||
public static final String EXTRA_BACKGROUND = TERMUX_PACKAGE_NAME + ".RUN_COMMAND_BACKGROUND"; // Default: "com.termux.RUN_COMMAND_BACKGROUND"
|
public static final String EXTRA_BACKGROUND = TERMUX_PACKAGE_NAME + ".RUN_COMMAND_BACKGROUND"; // Default: "com.termux.RUN_COMMAND_BACKGROUND"
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -215,16 +408,14 @@ public final class TermuxConstants {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Termux:Styling app constants.
|
* Termux:Styling app constants.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static final class TERMUX_STYLING {
|
public static final class TERMUX_STYLING {
|
||||||
|
|
||||||
/**
|
/** Termux:Styling app core activity name. */
|
||||||
* Termux:Styling app core activity constants.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static final String TERMUX_STYLING_ACTIVITY_NAME = TERMUX_STYLING_PACKAGE_NAME + ".TermuxStyleActivity"; // Default: "com.termux.styling.TermuxStyleActivity"
|
public static final String TERMUX_STYLING_ACTIVITY_NAME = TERMUX_STYLING_PACKAGE_NAME + ".TermuxStyleActivity"; // Default: "com.termux.styling.TermuxStyleActivity"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -58,7 +58,7 @@ final class TermuxInstaller {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final File PREFIX_FILE = new File(TermuxConstants.PREFIX_PATH);
|
final File PREFIX_FILE = TermuxConstants.TERMUX_PREFIX_DIR;
|
||||||
if (PREFIX_FILE.isDirectory()) {
|
if (PREFIX_FILE.isDirectory()) {
|
||||||
whenDone.run();
|
whenDone.run();
|
||||||
return;
|
return;
|
||||||
@@ -69,7 +69,7 @@ final class TermuxInstaller {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
final String STAGING_PREFIX_PATH = TermuxConstants.FILES_PATH + "/usr-staging";
|
final String STAGING_PREFIX_PATH = TermuxConstants.TERMUX_STAGING_PREFIX_DIR_PATH;
|
||||||
final File STAGING_PREFIX_FILE = new File(STAGING_PREFIX_PATH);
|
final File STAGING_PREFIX_FILE = new File(STAGING_PREFIX_PATH);
|
||||||
|
|
||||||
if (STAGING_PREFIX_FILE.exists()) {
|
if (STAGING_PREFIX_FILE.exists()) {
|
||||||
@@ -194,7 +194,7 @@ final class TermuxInstaller {
|
|||||||
new Thread() {
|
new Thread() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
File storageDir = new File(TermuxConstants.HOME_PATH, "storage");
|
File storageDir = TermuxConstants.TERMUX_STORAGE_HOME_DIR;
|
||||||
|
|
||||||
if (storageDir.exists()) {
|
if (storageDir.exists()) {
|
||||||
try {
|
try {
|
||||||
|
@@ -178,7 +178,7 @@ public class TermuxOpenReceiver extends BroadcastReceiver {
|
|||||||
String path = file.getCanonicalPath();
|
String path = file.getCanonicalPath();
|
||||||
String storagePath = Environment.getExternalStorageDirectory().getCanonicalPath();
|
String storagePath = Environment.getExternalStorageDirectory().getCanonicalPath();
|
||||||
// See https://support.google.com/faqs/answer/7496913:
|
// See https://support.google.com/faqs/answer/7496913:
|
||||||
if (!(path.startsWith(TermuxConstants.FILES_PATH) || path.startsWith(storagePath))) {
|
if (!(path.startsWith(TermuxConstants.TERMUX_FILES_DIR_PATH) || path.startsWith(storagePath))) {
|
||||||
throw new IllegalArgumentException("Invalid path: " + path);
|
throw new IllegalArgumentException("Invalid path: " + path);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@@ -238,7 +238,7 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
File termuxTmpDir = new File(TermuxConstants.PREFIX_PATH + "/tmp");
|
File termuxTmpDir = TermuxConstants.TERMUX_TMP_DIR;
|
||||||
|
|
||||||
if (termuxTmpDir.exists()) {
|
if (termuxTmpDir.exists()) {
|
||||||
try {
|
try {
|
||||||
@@ -264,9 +264,9 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
|||||||
}
|
}
|
||||||
|
|
||||||
TerminalSession createTermSession(String executablePath, String[] arguments, String cwd, boolean failSafe) {
|
TerminalSession createTermSession(String executablePath, String[] arguments, String cwd, boolean failSafe) {
|
||||||
new File(TermuxConstants.HOME_PATH).mkdirs();
|
TermuxConstants.TERMUX_HOME_DIR.mkdirs();
|
||||||
|
|
||||||
if (cwd == null || cwd.isEmpty()) cwd = TermuxConstants.HOME_PATH;
|
if (cwd == null || cwd.isEmpty()) cwd = TermuxConstants.TERMUX_HOME_DIR_PATH;
|
||||||
|
|
||||||
String[] env = BackgroundJob.buildEnvironment(failSafe, cwd);
|
String[] env = BackgroundJob.buildEnvironment(failSafe, cwd);
|
||||||
boolean isLoginShell = false;
|
boolean isLoginShell = false;
|
||||||
@@ -274,7 +274,7 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
|||||||
if (executablePath == null) {
|
if (executablePath == null) {
|
||||||
if (!failSafe) {
|
if (!failSafe) {
|
||||||
for (String shellBinary : new String[]{"login", "bash", "zsh"}) {
|
for (String shellBinary : new String[]{"login", "bash", "zsh"}) {
|
||||||
File shellFile = new File(TermuxConstants.PREFIX_PATH + "/bin/" + shellBinary);
|
File shellFile = new File(TermuxConstants.TERMUX_BIN_PREFIX_DIR_PATH, shellBinary);
|
||||||
if (shellFile.canExecute()) {
|
if (shellFile.canExecute()) {
|
||||||
executablePath = shellFile.getAbsolutePath();
|
executablePath = shellFile.getAbsolutePath();
|
||||||
break;
|
break;
|
||||||
|
@@ -8,16 +8,19 @@ import com.termux.app.TermuxConstants;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Version: v0.1.0
|
* Version: v0.2.0
|
||||||
*
|
*
|
||||||
* Changelog
|
* Changelog
|
||||||
*
|
*
|
||||||
* - 0.1.0 (2021-03-08)
|
* - 0.1.0 (2021-03-11)
|
||||||
* - Initial Release
|
* - Initial Release.
|
||||||
|
* - 0.2.0 (2021-03-11)
|
||||||
|
* - Renamed `HOME_PATH` to `TERMUX_HOME_DIR_PATH`
|
||||||
|
* - Renamed `TERMUX_PROPERTIES_PRIMARY_PATH` to `TERMUX_PROPERTIES_PRIMARY_FILE_PATH`
|
||||||
|
* - Renamed `TERMUX_PROPERTIES_SECONDARY_FILE_PATH` to `TERMUX_PROPERTIES_SECONDARY_FILE_PATH`
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,8 +32,8 @@ import java.util.Set;
|
|||||||
* * and add an entry in the Changelog section above.
|
* * and add an entry in the Changelog section above.
|
||||||
*
|
*
|
||||||
* The properties are loaded from the first file found at
|
* The properties are loaded from the first file found at
|
||||||
* {@link TermuxConstants#TERMUX_PROPERTIES_PRIMARY_PATH} or
|
* {@link TermuxConstants#TERMUX_PROPERTIES_PRIMARY_FILE_PATH} or
|
||||||
* {@link TermuxConstants#TERMUX_PROPERTIES_SECONDARY_PATH}
|
* {@link TermuxConstants#TERMUX_PROPERTIES_SECONDARY_FILE_PATH}
|
||||||
*/
|
*/
|
||||||
public final class TermuxPropertyConstants {
|
public final class TermuxPropertyConstants {
|
||||||
|
|
||||||
@@ -132,7 +135,7 @@ public final class TermuxPropertyConstants {
|
|||||||
/** Defines the key for the default working directory */
|
/** Defines the key for the default working directory */
|
||||||
public static final String KEY_DEFAULT_WORKING_DIRECTORY = "default-working-directory"; // Default: "default-working-directory"
|
public static final String KEY_DEFAULT_WORKING_DIRECTORY = "default-working-directory"; // Default: "default-working-directory"
|
||||||
/** Defines the default working directory */
|
/** Defines the default working directory */
|
||||||
public static final String DEFAULT_IVALUE_DEFAULT_WORKING_DIRECTORY = TermuxConstants.HOME_PATH;
|
public static final String DEFAULT_IVALUE_DEFAULT_WORKING_DIRECTORY = TermuxConstants.TERMUX_HOME_DIR_PATH;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -197,8 +200,8 @@ public final class TermuxPropertyConstants {
|
|||||||
|
|
||||||
|
|
||||||
/** Returns the first {@link File} found at
|
/** Returns the first {@link File} found at
|
||||||
* {@link TermuxConstants#TERMUX_PROPERTIES_PRIMARY_PATH} or
|
* {@link TermuxConstants#TERMUX_PROPERTIES_PRIMARY_FILE_PATH} or
|
||||||
* {@link TermuxConstants#TERMUX_PROPERTIES_SECONDARY_PATH}
|
* {@link TermuxConstants#TERMUX_PROPERTIES_SECONDARY_FILE_PATH}
|
||||||
* from which termux properties can be loaded.
|
* from which termux properties can be loaded.
|
||||||
* If the {@link File} found is not a regular file or is not readable then null is returned.
|
* If the {@link File} found is not a regular file or is not readable then null is returned.
|
||||||
*
|
*
|
||||||
@@ -206,8 +209,8 @@ public final class TermuxPropertyConstants {
|
|||||||
*/
|
*/
|
||||||
public static File getTermuxPropertiesFile() {
|
public static File getTermuxPropertiesFile() {
|
||||||
String[] possiblePropertiesFileLocations = {
|
String[] possiblePropertiesFileLocations = {
|
||||||
TermuxConstants.TERMUX_PROPERTIES_PRIMARY_PATH,
|
TermuxConstants.TERMUX_PROPERTIES_PRIMARY_FILE_PATH,
|
||||||
TermuxConstants.TERMUX_PROPERTIES_SECONDARY_PATH
|
TermuxConstants.TERMUX_PROPERTIES_SECONDARY_FILE_PATH
|
||||||
};
|
};
|
||||||
|
|
||||||
File propertiesFile = new File(possiblePropertiesFileLocations[0]);
|
File propertiesFile = new File(possiblePropertiesFileLocations[0]);
|
||||||
|
@@ -35,7 +35,7 @@ public class TermuxDocumentsProvider extends DocumentsProvider {
|
|||||||
|
|
||||||
private static final String ALL_MIME_TYPES = "*/*";
|
private static final String ALL_MIME_TYPES = "*/*";
|
||||||
|
|
||||||
private static final File BASE_DIR = new File(TermuxConstants.HOME_PATH);
|
private static final File BASE_DIR = TermuxConstants.TERMUX_HOME_DIR;
|
||||||
|
|
||||||
|
|
||||||
// The default columns to return information about a root if no specific
|
// The default columns to return information about a root if no specific
|
||||||
@@ -171,7 +171,7 @@ public class TermuxDocumentsProvider extends DocumentsProvider {
|
|||||||
// through the whole SD card).
|
// through the whole SD card).
|
||||||
boolean isInsideHome;
|
boolean isInsideHome;
|
||||||
try {
|
try {
|
||||||
isInsideHome = file.getCanonicalPath().startsWith(TermuxConstants.HOME_PATH);
|
isInsideHome = file.getCanonicalPath().startsWith(TermuxConstants.TERMUX_HOME_DIR_PATH);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
isInsideHome = true;
|
isInsideHome = true;
|
||||||
}
|
}
|
||||||
|
@@ -27,9 +27,9 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
public class TermuxFileReceiverActivity extends Activity {
|
public class TermuxFileReceiverActivity extends Activity {
|
||||||
|
|
||||||
static final String TERMUX_RECEIVEDIR = TermuxConstants.FILES_PATH + "/home/downloads";
|
static final String TERMUX_RECEIVEDIR = TermuxConstants.TERMUX_FILES_DIR_PATH + "/home/downloads";
|
||||||
static final String EDITOR_PROGRAM = TermuxConstants.HOME_PATH + "/bin/termux-file-editor";
|
static final String EDITOR_PROGRAM = TermuxConstants.TERMUX_HOME_DIR_PATH + "/bin/termux-file-editor";
|
||||||
static final String URL_OPENER_PROGRAM = TermuxConstants.HOME_PATH + "/bin/termux-url-opener";
|
static final String URL_OPENER_PROGRAM = TermuxConstants.TERMUX_HOME_DIR_PATH + "/bin/termux-url-opener";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the activity should be finished when the name input dialog is dismissed. This is disabled
|
* If the activity should be finished when the name input dialog is dismissed. This is disabled
|
||||||
|
Reference in New Issue
Block a user