mirror of
https://github.com/nix-community/nix-on-droid-app.git
synced 2025-11-27 20:51:09 +01:00
Fix current working directory default value
This commit fixes the issue when `cwd` is empty and is passed to `Runtime.getRuntime().exec(progArray, env, new File(cwd));`, it raises the `No such file or directory` exceptions when targeting sdk `29`.
This commit is contained in:
parent
108e4cb391
commit
85b2c44ac7
2 changed files with 3 additions and 3 deletions
|
|
@ -36,7 +36,7 @@ public final class BackgroundJob {
|
|||
|
||||
public BackgroundJob(String cwd, String fileToExecute, final String[] args, final TermuxService service, PendingIntent pendingIntent) {
|
||||
String[] env = buildEnvironment(false, cwd);
|
||||
if (cwd == null) cwd = TermuxService.HOME_PATH;
|
||||
if (cwd == null || cwd.isEmpty()) cwd = TermuxService.HOME_PATH;
|
||||
|
||||
final String[] progArray = setupProcessArgs(fileToExecute, args);
|
||||
final String processDescription = Arrays.toString(progArray);
|
||||
|
|
@ -136,7 +136,7 @@ public final class BackgroundJob {
|
|||
static String[] buildEnvironment(boolean failSafe, String cwd) {
|
||||
new File(TermuxService.HOME_PATH).mkdirs();
|
||||
|
||||
if (cwd == null) cwd = TermuxService.HOME_PATH;
|
||||
if (cwd == null || cwd.isEmpty()) cwd = TermuxService.HOME_PATH;
|
||||
|
||||
List<String> environment = new ArrayList<>();
|
||||
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ public final class TermuxService extends Service implements SessionChangedCallba
|
|||
TerminalSession createTermSession(String executablePath, String[] arguments, String cwd, boolean failSafe) {
|
||||
new File(HOME_PATH).mkdirs();
|
||||
|
||||
if (cwd == null) cwd = HOME_PATH;
|
||||
if (cwd == null || cwd.isEmpty()) cwd = HOME_PATH;
|
||||
|
||||
String[] env = BackgroundJob.buildEnvironment(failSafe, cwd);
|
||||
boolean isLoginShell = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue