public Path defaultRoot() { return absoluteGetRoot( FS.getPath( "" ).toAbsolutePath() ); }
public static URI toURIWithRoot( FileSystem fs ) { return absoluteGetRoot( fs.getPath( "" ).toAbsolutePath() ).toUri(); }
public ReadonlyPlayground<T> set( Path root ) { descr.removeTopic( Writable.class ); descr.props.put( "playground", root ); if( !root.isAbsolute() ) { throw new IllegalArgumentException( "readonly root must be absolute " + root ); } if( !absoluteGetRoot( root ).equals( absoluteGetRoot( root.getFileSystem().getPath( "" ).toAbsolutePath() ) ) ) { descr.removeTopic( WorkingDirectoryInPlaygroundTree.class ); } return this; }
public static URI toURIWithoutPath( FileSystem fs ) { Path root = absoluteGetRoot( fs.getPath( "" ).toAbsolutePath() ); return URI.create( Strings.withoutSuffix( root.toUri().toString(), root.toString().replace( '\\', '/' ) ) ); }
public Playgrounds<T> std( Path root ) { descr.removeTopic( Readonly.class ); descr.props.put( "playground", root ); if( !root.isAbsolute() ) { throw new IllegalArgumentException( "root path must be nonnull and absolute " + root ); } if( !absoluteGetRoot( root ).equals( absoluteGetRoot( root.getFileSystem().getPath( "" ).toAbsolutePath() ))) { descr.removeTopic( WorkingDirectoryInPlaygroundTree.class ); } if( root.getFileSystem().equals( FileSystems.getDefault() ) ) { descr.removeTopic( NotDefaultFileSystem.class ); } return this; }
public Path otherFSAbsA() throws IOException { FileSystem fs = description.get( Path.class, SecondFS.PLAYGROUND2 ).getFileSystem(); return PathIKWID.absoluteGetRoot( fs.getPath( "" ).toAbsolutePath()).resolve( nameA() ); } public Path otherFSAbsAB() throws IOException {
public T set( Path root ) { descr.removeTopic( Readonly.class ); descr.props.put( "playground", root ); if( !root.isAbsolute() ) { throw new IllegalArgumentException( "root path must be nonull and absolute " + root ); } if( !absoluteGetRoot( root ).equals( absoluteGetRoot( root.getFileSystem().getPath( "" ).toAbsolutePath() ))) { descr.removeTopic( WorkingDirectoryInPlaygroundTree.class ); } if( root.getFileSystem().equals( FileSystems.getDefault() ) ) { descr.removeTopic( NotDefaultFileSystem.class ); } return t; }
private RealIt minusOne( RealIt it ) { EightyPath last = it.path; it.path = absoluteGetRoot( last ); it.foundSymLink = false; for( Path filename : last ) { if( filename.toString().equals( ".." ) ) { normalizeParentCase( it ); } else if( filename.toString().equals( "." ) ) { normalizeCurrentDirCase(); } else { it.path = it.path._resolve( it.path._getFileSystem().get80().getRealFileName( it.path, filename )); normalizeSymLink( it ); } } return it; }
@SuppressWarnings( "PMD.EmptyCatchBlock" ) // no watchservice is ok public FileSystem getClosedFS() throws IOException { if( description.closedFSVars == null ) { description.closedFSVars = new FSDescription.ClosedFSVars( description.get( Path.class, CLOSEABLE_PLAYGROUND ) ); } if( description.closedFSVars.fs == null ) { description.closedFSVars.fs = description.closedFSVars.play.getFileSystem(); } if( !description.closedFSVars.fs.isOpen() ) { return description.closedFSVars.fs; } description.closedFSVars.provider = description.closedFSVars.fs.provider(); description.closedFSVars.dirB = description.closedFSVars.play.resolve( nameB() ); Files.createDirectories( description.closedFSVars.dirB ); description.closedFSVars.fileA = description.closedFSVars.play.resolve( nameA() ); Files.write( description.closedFSVars.fileA, CONTENT, standardOpen ); Path closedCf = description.closedFSVars.play.resolve( nameC() ); Files.write( closedCf, CONTENT, standardOpen ); description.closedFSVars.readChannel = Files.newByteChannel( closedCf, READ ); description.closedFSVars.uri = absoluteGetRoot( description.closedFSVars.play ).toUri(); description.closedFSVars.dirStream = Files.newDirectoryStream( description.closedFSVars.play ); try { description.closedFSVars.watchService = description.closedFSVars.fs.newWatchService(); } catch( IOException | UnsupportedOperationException e ) { // NOSONAR // no watchservice provided } description.closedFSVars.fs.close(); return description.closedFSVars.fs; }