Check and create TMPDIR if not exists before every build

This commit is contained in:
Akash Yadav
2022-01-10 13:05:12 +05:30
parent 4755b93cfa
commit 22071e6aee
3 changed files with 11 additions and 11 deletions
@@ -357,6 +357,9 @@ public class IDEService {
currentTask = task;
listener.appendOutput(task, getString(R.string.msg_task_begin, currentTime(), task.getName()));
try {
Environment.mkdirIfNotExits (Environment.TMP_DIR);
processExecutor.execAsync(holder, mProcessExitListener, projectRoot.getAbsolutePath(), true, getArguments(task.getTasks()));
isBuilding = true;
@@ -1,4 +1,4 @@
/************************************************************************************
/*
* This file is part of AndroidIDE.
*
* AndroidIDE is free software: you can redistribute it and/or modify
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
*
**************************************************************************************/
*/
package com.itsaky.androidide.services.builder;
import com.blankj.utilcode.util.ThreadUtils;
@@ -23,7 +23,7 @@ import com.itsaky.androidide.project.IDEProject;
import com.itsaky.androidide.tasks.GradleTask;
import java.util.Optional;
class MainThreadBuildListener implements BuildListener {
class MainThreadBuildListener implements BuildListener {
private final BuildListener listener;
@@ -181,6 +181,7 @@ public final class Environment {
ENV_VARS.put("LD_LIBRARY_PATH", ld);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && BaseApplication.isAarch64()) {
// Required for JDK 11
ENV_VARS.put("LD_PRELOAD", LIB_HOOK.getAbsolutePath());
}
@@ -223,7 +224,7 @@ public final class Environment {
}
}
public static String readProp (String key) {
public static String readPropOrNull (String key) {
return readProp(key, null);
}
@@ -244,14 +245,10 @@ public final class Environment {
return value;
}
@NonNull
public static String path(@NonNull File file) {
return file.getAbsolutePath();
}
public static File mkdirIfNotExits(File in) {
if (in != null && !in.exists())
FileUtils.createOrExistsDir(in);
if (in != null && !in.exists()) {
FileUtils.createOrExistsDir(in);
}
return in;
}