mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 07:30:24 +00:00
Various fixes
This commit is contained in:
parent
d9db3b1ef6
commit
1a7a3637e6
5 changed files with 16 additions and 5 deletions
|
@ -273,15 +273,15 @@ public class FileSystemHelper {
|
||||||
|
|
||||||
var baseRelative = FileNames.toDirectory(FileNames.getParent(source.getPath()));
|
var baseRelative = FileNames.toDirectory(FileNames.getParent(source.getPath()));
|
||||||
List<FileSystem.FileEntry> list = source.getFileSystem().listFilesRecursively(source.getPath());
|
List<FileSystem.FileEntry> list = source.getFileSystem().listFilesRecursively(source.getPath());
|
||||||
list.forEach(fileEntry -> {
|
for (FileSystem.FileEntry fileEntry : list) {
|
||||||
flatFiles.put(fileEntry, FileNames.toUnix(FileNames.relativize(baseRelative, fileEntry.getPath())));
|
flatFiles.put(fileEntry, FileNames.toUnix(FileNames.relativize(baseRelative, fileEntry.getPath())));
|
||||||
if (fileEntry.getKind() == FileKind.FILE) {
|
if (fileEntry.getKind() == FileKind.FILE) {
|
||||||
totalSize.addAndGet(fileEntry.getSize());
|
totalSize.addAndGet(fileEntry.getFileSystem().getFileSize(fileEntry.getPath()));
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
} else {
|
} else {
|
||||||
flatFiles.put(source, FileNames.getFileName(source.getPath()));
|
flatFiles.put(source, FileNames.getFileName(source.getPath()));
|
||||||
totalSize.addAndGet(source.getSize());
|
totalSize.addAndGet(source.getFileSystem().getFileSize(source.getPath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
AtomicLong transferred = new AtomicLong();
|
AtomicLong transferred = new AtomicLong();
|
||||||
|
@ -303,8 +303,9 @@ public class FileSystemHelper {
|
||||||
InputStream inputStream = null;
|
InputStream inputStream = null;
|
||||||
OutputStream outputStream = null;
|
OutputStream outputStream = null;
|
||||||
try {
|
try {
|
||||||
|
var fileSize = sourceFile.getFileSystem().getFileSize(sourceFile.getPath());
|
||||||
inputStream = sourceFile.getFileSystem().openInput(sourceFile.getPath());
|
inputStream = sourceFile.getFileSystem().openInput(sourceFile.getPath());
|
||||||
outputStream = target.getFileSystem().openOutput(targetFile, sourceFile.getSize());
|
outputStream = target.getFileSystem().openOutput(targetFile, fileSize);
|
||||||
transferFile(sourceFile, inputStream, outputStream, transferred, totalSize, progress);
|
transferFile(sourceFile, inputStream, outputStream, transferred, totalSize, progress);
|
||||||
inputStream.transferTo(OutputStream.nullOutputStream());
|
inputStream.transferTo(OutputStream.nullOutputStream());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
|
|
@ -57,6 +57,7 @@ project.ext {
|
||||||
arch = getArchName()
|
arch = getArchName()
|
||||||
privateExtensions = file("$rootDir/private_extensions.txt").exists() ? file("$rootDir/private_extensions.txt").readLines() : []
|
privateExtensions = file("$rootDir/private_extensions.txt").exists() ? file("$rootDir/private_extensions.txt").readLines() : []
|
||||||
isFullRelease = System.getenv('RELEASE') != null && Boolean.parseBoolean(System.getenv('RELEASE'))
|
isFullRelease = System.getenv('RELEASE') != null && Boolean.parseBoolean(System.getenv('RELEASE'))
|
||||||
|
isPreRelease = System.getenv('PRERELEASE') != null && Boolean.parseBoolean(System.getenv('PRERELEASE'))
|
||||||
isStage = System.getenv('STAGE') != null && Boolean.parseBoolean(System.getenv('STAGE'))
|
isStage = System.getenv('STAGE') != null && Boolean.parseBoolean(System.getenv('STAGE'))
|
||||||
rawVersion = file('version').text.trim()
|
rawVersion = file('version').text.trim()
|
||||||
versionString = rawVersion + (isFullRelease || isStage ? '' : '-SNAPSHOT')
|
versionString = rawVersion + (isFullRelease || isStage ? '' : '-SNAPSHOT')
|
||||||
|
|
|
@ -35,6 +35,8 @@ public interface ShellDialect {
|
||||||
|
|
||||||
String queryVersion(ShellControl shellControl) throws Exception;
|
String queryVersion(ShellControl shellControl) throws Exception;
|
||||||
|
|
||||||
|
CommandControl queryFileSize(ShellControl shellControl, String file);
|
||||||
|
|
||||||
CommandControl prepareUserTempDirectory(ShellControl shellControl, String directory);
|
CommandControl prepareUserTempDirectory(ShellControl shellControl, String directory);
|
||||||
|
|
||||||
String initFileName(ShellControl sc) throws Exception;
|
String initFileName(ShellControl sc) throws Exception;
|
||||||
|
|
|
@ -25,6 +25,11 @@ public class ConnectionFileSystem implements FileSystem {
|
||||||
this.store = store;
|
this.store = store;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getFileSize(String file) throws Exception {
|
||||||
|
return Long.parseLong(shellControl.getShellDialect().queryFileSize(shellControl, file).readStdoutOrThrow());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FileSystemStore getStore() {
|
public FileSystemStore getStore() {
|
||||||
return store;
|
return store;
|
||||||
|
|
|
@ -17,6 +17,8 @@ import java.util.stream.Stream;
|
||||||
|
|
||||||
public interface FileSystem extends Closeable, AutoCloseable {
|
public interface FileSystem extends Closeable, AutoCloseable {
|
||||||
|
|
||||||
|
long getFileSize(String file) throws Exception;
|
||||||
|
|
||||||
FileSystemStore getStore();
|
FileSystemStore getStore();
|
||||||
|
|
||||||
Optional<ShellControl> getShell();
|
Optional<ShellControl> getShell();
|
||||||
|
|
Loading…
Reference in a new issue