这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/src/main/java/com/termux/app/TermuxInstaller.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.termux.shared.android.PackageUtils;
import com.termux.shared.termux.TermuxConstants;
import com.termux.shared.termux.TermuxUtils;
import com.termux.shared.termux.settings.properties.TermuxAppSharedProperties;
import com.termux.shared.termux.shell.command.environment.TermuxShellEnvironment;

import java.io.BufferedReader;
Expand Down Expand Up @@ -281,6 +282,9 @@ static void setupStorageSymlinks(final Context context) {
Logger.logInfo(LOG_TAG, "Setting up storage symlinks.");

new Thread() {

private static final char ZERO_WIDTH_SPACE = '\u200b';

public void run() {
try {
Error error;
Expand All @@ -300,7 +304,7 @@ public void run() {

// Get primary storage root "/storage/emulated/0" symlink
File sharedDir = Environment.getExternalStorageDirectory();
Os.symlink(sharedDir.getAbsolutePath(), new File(storageDir, "shared").getAbsolutePath());
Os.symlink(sharedDir.getAbsolutePath() + (TermuxAppSharedProperties.getProperties().isAppendZeroWidthSpaceToSymlinkShared() ? String.valueOf(ZERO_WIDTH_SPACE) : ""), new File(storageDir, "shared").getAbsolutePath());

File documentsDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS);
Os.symlink(documentsDir.getAbsolutePath(), new File(storageDir, "documents").getAbsolutePath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ public final class TermuxPropertyConstants {



/** Defines the key for whether to append 'Zero Width Space' to symlink shared
* Allows to access the “Android/data” or “Android/obb” folders in Android 11+ without root privileges.
*/
public static final String KEY_APPEND_ZERO_WIDTH_SPACE_TO_SYMLINK_SHARED = "append-zero-width-space-to-symlink-shared"; // Default: "default-working-directory"



/** Defines the key for whether to use fullscreen */
public static final String KEY_USE_FULLSCREEN = "fullscreen"; // Default: "fullscreen"

Expand Down Expand Up @@ -401,6 +408,7 @@ public final class TermuxPropertyConstants {
KEY_RUN_TERMUX_AM_SOCKET_SERVER,
KEY_TERMINAL_ONCLICK_URL_OPEN,
KEY_USE_CTRL_SPACE_WORKAROUND,
KEY_APPEND_ZERO_WIDTH_SPACE_TO_SYMLINK_SHARED,
KEY_USE_FULLSCREEN,
KEY_USE_FULLSCREEN_WORKAROUND,
TermuxConstants.PROP_ALLOW_EXTERNAL_APPS,
Expand Down Expand Up @@ -447,6 +455,7 @@ public final class TermuxPropertyConstants {
KEY_HIDE_SOFT_KEYBOARD_ON_STARTUP,
KEY_TERMINAL_ONCLICK_URL_OPEN,
KEY_USE_CTRL_SPACE_WORKAROUND,
KEY_APPEND_ZERO_WIDTH_SPACE_TO_SYMLINK_SHARED,
KEY_USE_FULLSCREEN,
KEY_USE_FULLSCREEN_WORKAROUND,
TermuxConstants.PROP_ALLOW_EXTERNAL_APPS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,10 @@ public boolean isUsingCtrlSpaceWorkaround() {
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_USE_CTRL_SPACE_WORKAROUND, true);
}

public boolean isAppendZeroWidthSpaceToSymlinkShared() {
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_APPEND_ZERO_WIDTH_SPACE_TO_SYMLINK_SHARED, true);
}

public boolean isUsingFullScreen() {
return (boolean) getInternalPropertyValue(TermuxPropertyConstants.KEY_USE_FULLSCREEN, true);
}
Expand Down