Added: Add functions to get dirname and basename in FileUtils

This commit is contained in:
agnostic-apollo
2021-10-21 23:53:50 +05:00
parent 63c106c746
commit f7ebcae7b3
2 changed files with 41 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
package com.termux.shared.shell;
import com.termux.shared.file.FileUtils;
import com.termux.terminal.TerminalBuffer;
import com.termux.terminal.TerminalEmulator;
import com.termux.terminal.TerminalSession;
@@ -23,9 +24,7 @@ public class ShellUtils {
}
public static String getExecutableBasename(String executable) {
if (executable == null) return null;
int lastSlash = executable.lastIndexOf('/');
return (lastSlash == -1) ? executable : executable.substring(lastSlash + 1);
return FileUtils.getFileBasename(executable);
}
public static String getTerminalSessionTranscriptText(TerminalSession terminalSession, boolean linesJoined, boolean trim) {