Skip to content

Commit 514f592

Browse files
Leonid Plyushchfornwall
Leonid Plyushch
authored andcommitted
let $PREFIX/tmp be cleaned when TermuxService is going to be stopped
1 parent 9f79393 commit 514f592

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,18 @@ private Notification buildNotification() {
237237

238238
@Override
239239
public void onDestroy() {
240+
File termuxTmpDir = new File(TermuxService.PREFIX_PATH + "/tmp");
241+
242+
if (termuxTmpDir.exists()) {
243+
try {
244+
TermuxInstaller.deleteFolder(termuxTmpDir.getCanonicalFile());
245+
} catch (Exception e) {
246+
Log.e(EmulatorDebug.LOG_TAG, "Error while removing directory " + termuxTmpDir.getAbsolutePath(), e);
247+
}
248+
249+
termuxTmpDir.mkdirs();
250+
}
251+
240252
if (mWakeLock != null) mWakeLock.release();
241253
if (mWifiLock != null) mWifiLock.release();
242254

0 commit comments

Comments
 (0)