Skip to content

Commit b34f60b

Browse files
Fix the bootstrap reinstallation logic for when PREFIX is a symlink
Changes were made to bootstrap reinstallation logic in 107927f, but it wasn't considering that PREFIX may be a symlink file to a directory instead of a directory file. With this commit, the previous behaviour of termux is restored where PREFIX can optionally be a symlink to a valid directory where the symlink isn't broken/dangling.
1 parent 0fe608f commit b34f60b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/src/main/java/com/termux/app/TermuxInstaller.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ static void setupBootstrapIfNeeded(final Activity activity, final Runnable whenD
6565
final String PREFIX_FILE_PATH = TermuxConstants.TERMUX_PREFIX_DIR_PATH;
6666
final File PREFIX_FILE = TermuxConstants.TERMUX_PREFIX_DIR;
6767

68-
// If prefix directory exists
69-
if (FileUtils.directoryFileExists(PREFIX_FILE_PATH, false)) {
68+
// If prefix directory exists, even if its a symlink to a valid directory and symlink is not broken/dangling
69+
if (FileUtils.directoryFileExists(PREFIX_FILE_PATH, true)) {
7070
File[] PREFIX_FILE_LIST = PREFIX_FILE.listFiles();
7171
// If prefix directory is empty or only contains the tmp directory
7272
if(PREFIX_FILE_LIST == null || PREFIX_FILE_LIST.length == 0 || (PREFIX_FILE_LIST.length == 1 && TermuxConstants.TERMUX_TMP_PREFIX_DIR_PATH.equals(PREFIX_FILE_LIST[0].getAbsolutePath()))) {

0 commit comments

Comments
 (0)