feat(gui): add button to install desktop file directly from jadx-gui (PR #2404)
* fix: missing/incorrect .desktop file values - correct comment - Add StartupWMClass * feat: add button to install desktop file from jadx-gui (#1392) * fix: use POSIX compliant realpath instead of readlink * fix: get XDG executable from PATH
This commit is contained in:
@@ -231,6 +231,16 @@ public class FileUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static Path createTempFileNonPrefixed(String fileName) {
|
||||
try {
|
||||
Path path = Files.createFile(tempRootDir.resolve(fileName));
|
||||
path.toFile().deleteOnExit();
|
||||
return path;
|
||||
} catch (Exception e) {
|
||||
throw new JadxRuntimeException("Failed to create non-prefixed temp file: " + fileName, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyStream(InputStream input, OutputStream output) throws IOException {
|
||||
byte[] buffer = new byte[READ_BUFFER_SIZE];
|
||||
while (true) {
|
||||
@@ -266,6 +276,11 @@ public class FileUtils {
|
||||
StandardOpenOption.WRITE, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
|
||||
}
|
||||
|
||||
public static void writeFile(Path file, InputStream is) throws IOException {
|
||||
FileUtils.makeDirsForFile(file);
|
||||
Files.copy(is, file, StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
|
||||
public static String readFile(Path textFile) throws IOException {
|
||||
return Files.readString(textFile);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user