From 46cd57db188e04783f1c73005637dce536f6c245 Mon Sep 17 00:00:00 2001 From: crschnick Date: Thu, 18 Jan 2024 17:15:35 +0000 Subject: [PATCH] Small fixes --- .../io/xpipe/app/storage/StandardStorage.java | 5 -- .../java/io/xpipe/app/util/XPipeSession.java | 46 ++----------------- .../resources/lang/preferences_en.properties | 1 + dist/build.gradle | 4 ++ 4 files changed, 8 insertions(+), 48 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/storage/StandardStorage.java b/app/src/main/java/io/xpipe/app/storage/StandardStorage.java index f358e33d8..66064ef0c 100644 --- a/app/src/main/java/io/xpipe/app/storage/StandardStorage.java +++ b/app/src/main/java/io/xpipe/app/storage/StandardStorage.java @@ -4,7 +4,6 @@ import io.xpipe.app.comp.store.StoreSortMode; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.prefs.AppPrefs; -import io.xpipe.app.util.XPipeSession; import io.xpipe.core.store.LocalStore; import lombok.Getter; import org.apache.commons.io.FileUtils; @@ -38,10 +37,6 @@ public class StandardStorage extends DataStorage { gitStorageHandler.onReset(); } - private boolean isNewSession() { - return XPipeSession.get().isNewSystemSession(); - } - private void deleteLeftovers() { var storesDir = getStoresDir(); var categoriesDir = getCategoriesDir(); diff --git a/app/src/main/java/io/xpipe/app/util/XPipeSession.java b/app/src/main/java/io/xpipe/app/util/XPipeSession.java index 4ab9f4db0..4f85b3b04 100644 --- a/app/src/main/java/io/xpipe/app/util/XPipeSession.java +++ b/app/src/main/java/io/xpipe/app/util/XPipeSession.java @@ -1,21 +1,13 @@ package io.xpipe.app.util; import io.xpipe.app.core.AppCache; -import io.xpipe.app.core.AppProperties; -import io.xpipe.core.process.OsType; -import io.xpipe.core.util.UuidHelper; import lombok.Value; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.attribute.BasicFileAttributes; import java.util.UUID; @Value public class XPipeSession { - boolean isNewSystemSession; - boolean isNewBuildSession; /** @@ -28,10 +20,6 @@ public class XPipeSession { */ UUID buildSessionId; - /** - * Unique identifier that resets on system restarts. - */ - UUID systemSessionId; private static XPipeSession INSTANCE; @@ -40,38 +28,10 @@ public class XPipeSession { return; } - var sessionFile = Path.of(System.getProperty("java.io.tmpdir")).resolve("xpipe_session"); - var isNewSystemSession = !Files.exists(sessionFile); - var systemSessionId = isNewSystemSession - ? UUID.randomUUID() - : UuidHelper.parse(() -> Files.readString(sessionFile)).orElse(UUID.randomUUID()); - - try { - // TODO: People might move their page file to another drive - if (OsType.getLocal().equals(OsType.WINDOWS)) { - var pf = Path.of("C:\\pagefile.sys"); - BasicFileAttributes attr = Files.readAttributes(pf, BasicFileAttributes.class); - var timeUuid = UUID.nameUUIDFromBytes( - attr.creationTime().toInstant().toString().getBytes()); - isNewSystemSession = isNewSystemSession && timeUuid.equals(systemSessionId); - systemSessionId = timeUuid; - } - } catch (Exception ex) { - isNewSystemSession = true; - systemSessionId = UUID.randomUUID(); - } - - try { - Files.writeString(sessionFile, systemSessionId.toString()); - } catch (Exception ignored) { - } - - var s = AppCache.get("lastBuild", String.class, () -> buildSessionId.toString()); + var s = AppCache.get("lastBuildId", String.class, () -> null); var isBuildChanged = !buildSessionId.toString().equals(s); - AppCache.update("lastBuild", AppProperties.get().getVersion()); - - INSTANCE = new XPipeSession( - isNewSystemSession, isBuildChanged, UUID.randomUUID(), buildSessionId, systemSessionId); + AppCache.update("lastBuildId", buildSessionId.toString()); + INSTANCE = new XPipeSession(isBuildChanged, UUID.randomUUID(), buildSessionId); } public static XPipeSession get() { diff --git a/app/src/main/resources/io/xpipe/app/resources/lang/preferences_en.properties b/app/src/main/resources/io/xpipe/app/resources/lang/preferences_en.properties index 55280c62c..6435d215c 100644 --- a/app/src/main/resources/io/xpipe/app/resources/lang/preferences_en.properties +++ b/app/src/main/resources/io/xpipe/app/resources/lang/preferences_en.properties @@ -142,6 +142,7 @@ cmd=cmd.exe powershell=Powershell pwsh=Powershell Core windowsTerminal=Windows Terminal +windowsTerminalPreview=Windows Terminal Preview gnomeTerminal=Gnome Terminal createLock=Create lock tilix=Tilix diff --git a/dist/build.gradle b/dist/build.gradle index f4bd074a7..d22e0091f 100644 --- a/dist/build.gradle +++ b/dist/build.gradle @@ -38,6 +38,10 @@ task createChecksums(type: Checksum) { doLast { def artifactChecksumsSha256Hex = new HashMap() for (final def file in outputDirectory.get().getAsFileTree().files) { + if (file.toString().endsWith('mapping.map')) { + continue + } + def name = file.name.lastIndexOf('.').with {it != -1 ? file.name[0..