X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/5c754b6f5d5bd3273b3c0722cf3eabbcd02c20b9..22f19c406779893d08675c2d06d2b7708cc3f2a8:/src/main/java/org/asamk/signal/util/IOUtils.java diff --git a/src/main/java/org/asamk/signal/util/IOUtils.java b/src/main/java/org/asamk/signal/util/IOUtils.java index 4d8adea6..59727a9a 100644 --- a/src/main/java/org/asamk/signal/util/IOUtils.java +++ b/src/main/java/org/asamk/signal/util/IOUtils.java @@ -46,11 +46,6 @@ public class IOUtils { return baos.toByteArray(); } - public static void createPrivateDirectories(String directoryPath) throws IOException { - final File file = new File(directoryPath); - createPrivateDirectories(file); - } - public static void createPrivateDirectories(File file) throws IOException { if (file.exists()) { return; @@ -65,8 +60,8 @@ public class IOUtils { } } - public static void createPrivateFile(String path) throws IOException { - final Path file = new File(path).toPath(); + public static void createPrivateFile(File path) throws IOException { + final Path file = path.toPath(); try { Set perms = EnumSet.of(OWNER_READ, OWNER_WRITE); Files.createFile(file, PosixFilePermissions.asFileAttribute(perms)); @@ -75,13 +70,13 @@ public class IOUtils { } } - public static String getDataHomeDir() { + public static File getDataHomeDir() { String dataHome = System.getenv("XDG_DATA_HOME"); if (dataHome != null) { - return dataHome; + return new File(dataHome); } - return System.getProperty("user.home") + "/.local/share"; + return new File(new File(System.getProperty("user.home"), ".local"), "share"); } public static void copyStreamToFile(InputStream input, File outputFile) throws IOException {