From 6e394805370ba3fbdee0900c7d5fd8a04c7c4b58 Mon Sep 17 00:00:00 2001 From: crschnick Date: Wed, 15 Mar 2023 23:51:25 +0000 Subject: [PATCH] Various small improvements [release] --- .../main/java/io/xpipe/app/browser/FileSystemHelper.java | 2 +- .../io/xpipe/app/comp/storage/store/StoreViewState.java | 5 +++-- core/src/main/java/io/xpipe/core/process/OsType.java | 9 ++++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/browser/FileSystemHelper.java b/app/src/main/java/io/xpipe/app/browser/FileSystemHelper.java index e8390b0c..45072151 100644 --- a/app/src/main/java/io/xpipe/app/browser/FileSystemHelper.java +++ b/app/src/main/java/io/xpipe/app/browser/FileSystemHelper.java @@ -86,7 +86,7 @@ public class FileSystemHelper { private static void dropFileAcrossSameFileSystem( FileSystem.FileEntry target, FileSystem.FileEntry source, boolean explicitCopy) throws Exception { // Prevent dropping directory into itself - if (FileNames.startsWith(source.getPath(), target.getPath())) { + if (source.getPath().equals(target.getPath())) { return; } diff --git a/app/src/main/java/io/xpipe/app/comp/storage/store/StoreViewState.java b/app/src/main/java/io/xpipe/app/comp/storage/store/StoreViewState.java index 00c8eac8..9812f344 100644 --- a/app/src/main/java/io/xpipe/app/comp/storage/store/StoreViewState.java +++ b/app/src/main/java/io/xpipe/app/comp/storage/store/StoreViewState.java @@ -1,7 +1,6 @@ package io.xpipe.app.comp.storage.store; import io.xpipe.app.comp.storage.StorageFilter; -import io.xpipe.app.fxcomps.util.BindingsHelper; import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.storage.DataSourceCollection; import io.xpipe.app.storage.DataStorage; @@ -30,7 +29,9 @@ public class StoreViewState { private final ObservableList shownEntries = FXCollections.observableList(new CopyOnWriteArrayList<>()); - private final ObservableBooleanValue empty = BindingsHelper.persist(Bindings.equal(Bindings.size(allEntries), 1)); + private final ObservableBooleanValue empty = Bindings.createBooleanBinding(() -> { + return allEntries.stream().allMatch(storeEntryWrapper -> !storeEntryWrapper.getEntry().getConfiguration().isRenameable()); + }, allEntries); private StoreViewState() { try { diff --git a/core/src/main/java/io/xpipe/core/process/OsType.java b/core/src/main/java/io/xpipe/core/process/OsType.java index 987d061b..45b1c934 100644 --- a/core/src/main/java/io/xpipe/core/process/OsType.java +++ b/core/src/main/java/io/xpipe/core/process/OsType.java @@ -144,7 +144,14 @@ public interface OsType { @Override public String getTempDirectory(ShellControl pc) throws Exception { - return pc.executeStringSimpleCommand(pc.getShellDialect().getPrintVariableCommand("TMPDIR")); + var found = pc.executeStringSimpleCommand(pc.getShellDialect().getPrintVariableCommand("TMPDIR")); + + // This variable is not defined for root users, so manually fix it. Why? ... + if (found.isBlank()) { + return "/tmp"; + } + + return found; } @Override