diff --git a/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltFileSystemProvider.groovy b/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltFileSystemProvider.groovy index 2b269aaf..604d2cf3 100644 --- a/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltFileSystemProvider.groovy +++ b/plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltFileSystemProvider.groovy @@ -85,22 +85,23 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr return path.getFileSystem().provider() } - static boolean localProvider(Path path) { + static boolean isLocalProvider(Path path) { FileSystemProvider provider = provider(path) - String providerName = provider?.class?.name?.toLowerCase() ?: '-' - println("QuiltFileSystemProvider.localProvider[${path}] -> ${providerName}") - return providerName.startsWith("unix") || providerName.startsWith("win") ||\ - providerName.startsWith("mac") || providerName.startsWith("fat") + String providerName = provider?.class?.name?.toLowerCase() ?: 'N/A' + println("QuiltFileSystemProvider.isLocalProvider[${path}] -> ${providerName}") + return providerName.contains("unix") || providerName.contains("win") ||\ + providerName.contains("mac") || providerName.contains("fat") ||\ + providerName == 'N/A' } boolean canDownload(Path source, Path target) { log.debug("QuiltFileSystemProvider.canDownload[${source}] -> ${target}") - return localProvider(target) && source instanceof QuiltPath + return isLocalProvider(target) && source instanceof QuiltPath } boolean canUpload(Path source, Path target) { log.debug("QuiltFileSystemProvider.canUpload[${source}] -> ${target}") - return localProvider(source) && target instanceof QuiltPath + return isLocalProvider(source) && target instanceof QuiltPath } void download(Path source, Path target, CopyOption... options) throws IOException { @@ -397,7 +398,7 @@ class QuiltFileSystemProvider extends FileSystemProvider implements FileSystemTr @Override boolean isHidden(Path path) throws IOException { - return path.getFileName()?.toString()?.startsWith('.') + return path.getFileName()?.toString()?.contains('.') } @Override diff --git a/plugins/nf-quilt/src/test/nextflow/quilt/nio/QuiltFileSystemProviderTest.groovy b/plugins/nf-quilt/src/test/nextflow/quilt/nio/QuiltFileSystemProviderTest.groovy index fc18641e..b8c92a52 100644 --- a/plugins/nf-quilt/src/test/nextflow/quilt/nio/QuiltFileSystemProviderTest.groovy +++ b/plugins/nf-quilt/src/test/nextflow/quilt/nio/QuiltFileSystemProviderTest.groovy @@ -3,6 +3,8 @@ package nextflow.quilt.nio import nextflow.quilt.QuiltSpecification import groovy.transform.CompileDynamic +import java.nio.file.Path +import java.nio.file.Paths /** * @@ -22,4 +24,14 @@ class QuiltFileSystemProviderTest extends QuiltSpecification { // newDirectoryStream returns package path for write // do we need a new schema for quilt+local? + void 'should recognize isLocalProvider'() { + given: + Path local = Paths.get('file:///tmp') + Path remote = Paths.get(new URI(fullURL)) + + expect: + QuiltFileSystemProvider.isLocalProvider(local) == true + QuiltFileSystemProvider.isLocalProvider(remote) == false + } + }