Small fixes [release]

This commit is contained in:
crschnick 2023-07-21 12:38:16 +00:00
parent 15e2986577
commit df85aa08a1
7 changed files with 49 additions and 32 deletions

View file

@ -213,6 +213,10 @@ public class FileSystemHelper {
private static void dropFileAcrossFileSystems(FileSystem.FileEntry target, FileSystem.FileEntry source)
throws Exception {
if (target.getKind() != FileKind.DIRECTORY) {
throw new IllegalStateException("Target " + target.getPath() + " is not a directory");
}
var flatFiles = new LinkedHashMap<FileSystem.FileEntry, String>();
// Prevent dropping directory into itself

View file

@ -10,6 +10,7 @@ import io.xpipe.app.ext.DataStoreProvider;
import io.xpipe.app.ext.DataStoreProviders;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.core.store.DataStore;
import io.xpipe.core.store.ExpandedLifecycleStore;
import io.xpipe.core.util.JacksonMapper;
import lombok.*;
import lombok.experimental.NonFinal;
@ -182,7 +183,7 @@ public class DataStoreEntry extends StorageElement {
public void setExpanded(boolean expanded) {
this.dirty = true;
this.expanded = expanded;
listeners.forEach(l -> l.onUpdate());
notifyListeners();
}
public DataStore getStore() {
@ -238,7 +239,7 @@ public class DataStoreEntry extends StorageElement {
information = null;
provider = null;
dirty = dirty || oldStore != null;
listeners.forEach(l -> l.onUpdate());
notifyListeners();
} else {
var newNode = DataStorageWriter.storeToNode(newStore);
var nodesEqual = Objects.equals(storeNode, newNode);
@ -259,7 +260,7 @@ public class DataStoreEntry extends StorageElement {
if (complete && deep) {
state = State.VALIDATING;
listeners.forEach(l -> l.onUpdate());
notifyListeners();
store.validate();
state = State.COMPLETE_AND_VALID;
information = getProvider().queryInformationString(getStore(), 50);
@ -283,38 +284,42 @@ public class DataStoreEntry extends StorageElement {
information = getProvider().queryInvalidInformationString(getStore(), 50);
throw e;
} finally {
propagateUpdate();
notifyListeners();
}
}
}
@SneakyThrows
public void initializeEntry() {
try {
state = State.VALIDATING;
listeners.forEach(l -> l.onUpdate());
store.initializeValidate();
state = State.COMPLETE_AND_VALID;
} catch (Exception e) {
state = State.COMPLETE_BUT_INVALID;
ErrorEvent.fromThrowable(e).handle();
} finally {
propagateUpdate();
if (store instanceof ExpandedLifecycleStore lifecycleStore) {
try {
state = State.VALIDATING;
notifyListeners();
lifecycleStore.initializeValidate();
state = State.COMPLETE_AND_VALID;
} catch (Exception e) {
state = State.COMPLETE_BUT_INVALID;
ErrorEvent.fromThrowable(e).handle();
} finally {
notifyListeners();
}
}
}
@SneakyThrows
public void finalizeEntry() {
try {
state = State.VALIDATING;
listeners.forEach(l -> l.onUpdate());
store.finalizeValidate();
state = State.COMPLETE_AND_VALID;
} catch (Exception e) {
state = State.COMPLETE_BUT_INVALID;
ErrorEvent.fromThrowable(e).handle();
} finally {
propagateUpdate();
if (store instanceof ExpandedLifecycleStore lifecycleStore) {
try {
state = State.VALIDATING;
notifyListeners();
lifecycleStore.finalizeValidate();
state = State.COMPLETE_AND_VALID;
} catch (Exception e) {
state = State.COMPLETE_BUT_INVALID;
ErrorEvent.fromThrowable(e).handle();
} finally {
notifyListeners();
}
}
}

View file

@ -51,12 +51,12 @@ public abstract class StorageElement {
public void updateLastUsed() {
this.lastUsed = Instant.now();
this.dirty = true;
this.listeners.forEach(l -> l.onUpdate());
notifyListeners();
}
protected abstract boolean shouldSave();
protected void propagateUpdate() {
protected void notifyListeners() {
listeners.forEach(l -> l.onUpdate());
}
@ -102,7 +102,7 @@ public abstract class StorageElement {
this.name = name;
this.dirty = true;
this.lastModified = Instant.now();
propagateUpdate();
notifyListeners();
}
public Instant getLastUsed() {

View file

@ -73,10 +73,6 @@ public interface DataStore {
*/
default void validate() throws Exception {}
default void initializeValidate() throws Exception {}
default void finalizeValidate() throws Exception {}
default void checkComplete() throws Exception {}
default boolean delete() {

View file

@ -0,0 +1,8 @@
package io.xpipe.core.store;
public interface ExpandedLifecycleStore extends DataStore{
default void initializeValidate() throws Exception {}
default void finalizeValidate() throws Exception {}
}

View file

@ -14,6 +14,8 @@
- Restyle sidebar to take up less space
- Improve scaling of connection list display information
- Improve askpass script retention
- Properly apply startup mode setting
- Fix some features not working on busybox systems due to unknown base64 --decode option
- Fix local elevation not working on macOS with Fig installed
- Fix commands and psql not launching when username contains spaces
- Many other small miscellaneous fixes and improvements

View file

@ -187,10 +187,12 @@ return 0 2>/dev/null
check_architecture "$(uname -m)" || exit 1
if ! [ -x "$(command -v apt)" ] && ! [ -x "$(command -v rpm)" ] && [ -x "$(command -v pacman)" ]; then
info "Installing from AUR"
info "Installing from AUR at https://aur.archlinux.org/xpipe.git"
rm -rf "/tmp/xpipe_aur" || true
git clone "https://aur.archlinux.org/xpipe.git" /tmp/xpipe_aur
cd "/tmp/xpipe_aur"
makepkg -si
launch
exit 0
fi