Small bug fixes [stage]

This commit is contained in:
crschnick 2023-06-08 13:53:04 +00:00
parent 01ebb66500
commit fa96073ada
5 changed files with 21 additions and 11 deletions

View file

@ -182,11 +182,10 @@ public class FileSystemHelper {
flatFiles.put(source, directoryName);
var baseRelative = FileNames.toDirectory(FileNames.getParent(source.getPath()));
try (var stream = source.getFileSystem().listFilesRecursively(source.getPath())) {
stream.forEach(fileEntry -> {
flatFiles.put(fileEntry, FileNames.toUnix(FileNames.relativize(baseRelative, fileEntry.getPath())));
});
}
List<FileSystem.FileEntry> list = source.getFileSystem().listFilesRecursively(source.getPath());
list.forEach(fileEntry -> {
flatFiles.put(fileEntry, FileNames.toUnix(FileNames.relativize(baseRelative, fileEntry.getPath())));
});
} else {
flatFiles.put(source, FileNames.getFileName(source.getPath()));
}

View file

@ -132,6 +132,7 @@ public class OpenFileSystemSavedState {
public void cd(String dir) {
if (dir == null) {
lastDirectory = null;
return;
}

View file

@ -83,6 +83,9 @@ public class AppTheme {
PlatformThread.runLaterIfNeeded(() -> {
for (Window window : Window.getWindows()) {
// Fix scene content not taking the correct size after style seed change
window.setWidth(window.getWidth() - 1);
var scene = window.getScene();
Image snapshot = scene.snapshot(null);
Pane root = (Pane) scene.getRoot();
@ -95,7 +98,9 @@ public class AppTheme {
new KeyFrame(Duration.ZERO, new KeyValue(imageView.opacityProperty(), 1, Interpolator.EASE_OUT)),
new KeyFrame(
Duration.millis(1250), new KeyValue(imageView.opacityProperty(), 0, Interpolator.EASE_OUT)));
transition.setOnFinished(e -> root.getChildren().remove(imageView));
transition.setOnFinished(e -> {
root.getChildren().remove(imageView);
});
transition.play();
}

View file

@ -48,7 +48,7 @@ notAnAbsolutePath=Not an absolute path
notADirectory=Not a directory
notAnEmptyDirectory=Not an empty directory
automaticallyUpdate=Check for updates
automaticallyUpdateDescription=When enabled, new release information is automatically fetched in the background while XPipe is running.
automaticallyUpdateDescription=When enabled, new release information is automatically fetched in the background while XPipe is running. You still have to explicitly confirm any update installation.
sendAnonymousErrorReports=Send anonymous error reports
sendUsageStatistics=Send anonymous usage statistics
storageDirectory=Storage directory

View file

@ -9,6 +9,7 @@ import java.io.Closeable;
import java.io.InputStream;
import java.io.OutputStream;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Stream;
@ -79,18 +80,22 @@ public interface FileSystem extends Closeable, AutoCloseable {
Stream<FileEntry> listFiles(String file) throws Exception;
default Stream<FileEntry> listFilesRecursively(String file) throws Exception {
return listFiles(file).flatMap(fileEntry -> {
default List<FileEntry> listFilesRecursively(String file) throws Exception {
var base = listFiles(file).toList();
return base.stream().flatMap(fileEntry -> {
if (fileEntry.getKind() != FileKind.DIRECTORY) {
return Stream.of(fileEntry);
}
try {
return Stream.concat(Stream.of(fileEntry), listFilesRecursively(fileEntry.getPath()));
var list = new ArrayList<FileEntry>();
list.add(fileEntry);
list.addAll(listFilesRecursively(fileEntry.getPath()));
return list.stream();
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}).toList();
}
List<String> listRoots() throws Exception;