mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-08-23 01:36:33 +00:00
More support for symlinks
This commit is contained in:
@@ -31,7 +31,9 @@ public interface ShellDialect {
|
||||
|
||||
CommandControl directoryExists(ShellControl shellControl, String directory);
|
||||
|
||||
CommandControl normalizeDirectory(ShellControl shellControl, String directory);
|
||||
CommandControl evaluateExpression(ShellControl shellControl, String s);
|
||||
|
||||
CommandControl resolveDirectory(ShellControl shellControl, String directory);
|
||||
|
||||
String fileArgument(String s);
|
||||
|
||||
|
||||
@@ -2,8 +2,11 @@ package io.xpipe.core.store;
|
||||
|
||||
import io.xpipe.core.impl.FileNames;
|
||||
import io.xpipe.core.process.ShellControl;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import lombok.Value;
|
||||
import lombok.experimental.NonFinal;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.InputStream;
|
||||
@@ -17,11 +20,14 @@ import java.util.stream.Stream;
|
||||
public interface FileSystem extends Closeable, AutoCloseable {
|
||||
|
||||
@Value
|
||||
@NonFinal
|
||||
class FileEntry {
|
||||
@NonNull
|
||||
FileSystem fileSystem;
|
||||
|
||||
@NonNull
|
||||
@NonFinal
|
||||
@Setter
|
||||
String path;
|
||||
|
||||
Instant date;
|
||||
@@ -52,11 +58,34 @@ public interface FileSystem extends Closeable, AutoCloseable {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public FileEntry resolved() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public static FileEntry ofDirectory(FileSystem fileSystem, String path) {
|
||||
return new FileEntry(fileSystem, path, Instant.now(), true, false, 0, null, FileKind.DIRECTORY);
|
||||
}
|
||||
}
|
||||
|
||||
@Value
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
class LinkFileEntry extends FileEntry {
|
||||
|
||||
@NonNull
|
||||
FileEntry target;
|
||||
|
||||
public LinkFileEntry(
|
||||
@NonNull FileSystem fileSystem, @NonNull String path, Instant date, boolean hidden, Boolean executable, long size, String mode, @NonNull FileEntry target
|
||||
) {
|
||||
super(fileSystem, path, date, hidden, executable, size, mode, FileKind.LINK);
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public FileEntry resolved() {
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
FileSystemStore getStore();
|
||||
|
||||
Optional<ShellControl> getShell();
|
||||
|
||||
Reference in New Issue
Block a user