Skip to content

Commit

Permalink
install on readAttributes
Browse files Browse the repository at this point in the history
  • Loading branch information
drernie committed Feb 6, 2024
1 parent c808d75 commit de88172
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import java.nio.file.attribute.BasicFileAttributes
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import nextflow.quilt.jep.QuiltParser
import nextflow.quilt.jep.QuiltPackage

/**
* Implements FileSystem interface for Quilt registries
Expand Down Expand Up @@ -63,7 +64,7 @@ final class QuiltFileSystem extends FileSystem implements Closeable {
}

void delete(QuiltPath path) {
//log.debug("QuiltFileSystem.delete: $path")
log.debug("QuiltFileSystem.delete: $path")
path.deinstall()
//throw new UnsupportedOperationException("Operation 'delete' is not supported by QuiltFileSystem")
}
Expand Down Expand Up @@ -109,6 +110,11 @@ final class QuiltFileSystem extends FileSystem implements Closeable {
log.debug("QuiltFileAttributes QuiltFileSystem.readAttributes($path)")
Path installedPath = path.localPath()
try {
QuiltPackage _pkg = path.pkg()
if (!_pkg.installed) {
log.debug("QuiltFileSystem.readAttributes: installing $_pkg")
_pkg.install()
}
BasicFileAttributes attrs = Files.readAttributes(installedPath, BasicFileAttributes)
return new QuiltFileAttributes(path, path.toString(), attrs)
}
Expand Down
5 changes: 3 additions & 2 deletions plugins/nf-quilt/src/main/nextflow/quilt/nio/QuiltPath.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ final class QuiltPath implements Path, Comparable {
return sub_paths()
}

// auto-install before using
Path localPath() {
Path pkgPath = pkg().packageDest()
assert pkgPath
Expand Down Expand Up @@ -112,15 +113,15 @@ final class QuiltPath implements Path, Comparable {

@Override
Path getFileName() {
log.debug("getFileName[${this}]: paths=$paths")
log.debug('QuiltPath.getFileName')
// if (isJustPackage()) { return this } // IF DIRECTORY
QuiltPath filePath = new QuiltPath(filesystem, parsed.lastPath(), true)
return filePath
}

@Override
Path getParent() {
//log.debug("${this}.getParent: ${paths}`")
//log.debug("QuiltPath.getParent: ${paths}`")
return new QuiltPath(filesystem, parsed.dropPath())
}

Expand Down

0 comments on commit de88172

Please sign in to comment.