diff --git a/src/qz/utils/FileUtilities.java b/src/qz/utils/FileUtilities.java index 4e02b9c49..f25cb33c4 100644 --- a/src/qz/utils/FileUtilities.java +++ b/src/qz/utils/FileUtilities.java @@ -69,7 +69,7 @@ public class FileUtilities { public static boolean zipLogs() { String date = new SimpleDateFormat("yyyy-MM-dd_HHmm").format(new Date()); String filename = Constants.DATA_DIR + "-" + date + ".zip"; - Path destination = Paths.get(System.getProperty("user.home"), "Desktop", filename); + Path destination = getUserDesktop().resolve(filename); try { zipDirectory(USER_DIR, destination); @@ -101,6 +101,20 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attributes) { outputStream.close(); } + /** + * Location where user Desktop is located + */ + private static Path getUserDesktop() { + // OneDrive will override the default location on Windows + if(SystemUtilities.isWindows()) { + try { + return Paths.get(WindowsSpecialFolders.DESKTOP.getPath()); + } + catch(Throwable ignore) {} + } + return Paths.get(System.getProperty("user.home"), "Desktop"); + } + /** * Location where preferences and logs are kept */