Small fixes

This commit is contained in:
crschnick 2023-12-04 14:49:25 +00:00
parent 4afa34378b
commit 6ef7f35887
4 changed files with 15 additions and 4 deletions

View file

@ -4,6 +4,7 @@ import atlantafx.base.theme.Styles;
import io.xpipe.app.browser.StandaloneFileBrowser;
import io.xpipe.app.comp.base.ButtonComp;
import io.xpipe.app.fxcomps.SimpleComp;
import io.xpipe.app.storage.DataStorage;
import io.xpipe.core.store.FileSystemStore;
import javafx.beans.property.Property;
import javafx.beans.property.SimpleBooleanProperty;
@ -41,7 +42,7 @@ public class FileStoreChoiceComp extends SimpleComp {
.grow(false, true);
var fileBrowseButton = new ButtonComp(null, new FontIcon("mdi2f-folder-open-outline"), () -> {
StandaloneFileBrowser.openSingleFile(() -> null, fileStore -> {
StandaloneFileBrowser.openSingleFile(() -> hideFileSystem ? DataStorage.get().local().ref() : null, fileStore -> {
if (fileStore == null) {
filePath.setValue(null);
fileSystem.setValue(null);

View file

@ -40,6 +40,9 @@ public abstract class DataStorage {
@Getter
protected boolean loaded;
@Getter
protected boolean disposed;
@Getter
protected final List<DataStoreCategory> storeCategories;
@ -104,11 +107,16 @@ public abstract class DataStorage {
return;
}
INSTANCE.onReset();
INSTANCE.save();
INSTANCE.dispose();
INSTANCE = null;
}
private synchronized void dispose() {
onReset();
save();
disposed = true;
}
protected void onReset() {}
public static DataStorage get() {

View file

@ -298,7 +298,7 @@ public class StandardStorage extends DataStorage {
}
public synchronized void save() {
if (!loaded) {
if (!loaded || disposed) {
return;
}

View file

@ -84,6 +84,7 @@ public enum XPipeDistributionType {
}
try (var sc = LocalStore.getShell()) {
// In theory, we can also add && !AppProperties.get().isStaging() here, but we want to replicate the production behavior
if (OsType.getLocal().equals(OsType.WINDOWS)) {
try (var chocoOut =
sc.command("choco search --local-only -r xpipe").start()) {
@ -100,6 +101,7 @@ public enum XPipeDistributionType {
}
}
// In theory, we can also add && !AppProperties.get().isStaging() here, but we want to replicate the production behavior
if (OsType.getLocal().equals(OsType.MACOS)) {
try (var brewOut = sc.command("brew list --casks --versions").start()) {
var out = brewOut.readStdoutDiscardErr();