public void createDirectory()

in src/main/java/com/pastdev/jsch/nio/file/UnixSshSftpHybridFileSystemProvider.java [41:92]


    public void createDirectory( Path path, FileAttribute<?>... fileAttributes ) throws IOException {
        final UnixSshPath unixPath = checkPath( path );
        Set<PosixFilePermission> permissions = null;
        for ( FileAttribute<?> fileAttribute : fileAttributes ) {
            if ( fileAttribute.name().equals( "posix:permissions" ) ) {
                permissions = (Set<PosixFilePermission>)fileAttribute.value();
            }
        }
        final int permissionsAsInt = permissions == null ? -1 : toInt( permissions );

        logger.debug( "Getting sftpRunner to execute sftp createDirectory" );

        /*
        ((UnixSshSftpHybridFileSystem)unixPath.getFileSystem()).getSftpRunner().execute( new Sftp() {
            @Override
            public void run( ChannelSftp sftp ) throws IOException {
                final String abspath = unixPath.toAbsolutePath().toString();

                SftpATTRS stat = null;
                try {
                    stat = sftp.lstat( abspath );
                }
                catch ( SftpException e ) {
                }

                if ( stat != null && stat.isDir() ) {
                    throw new FileAlreadyExistsException( "Directory " + unixPath + " already exists" );
                }

                if ( stat == null || !stat.isDir() ) {
                    try {
                        sftp.mkdir( abspath );
                    }
                    catch ( SftpException e ) {
                        throw new IOException( "Could not create directory", e );
                    }
                }

                if ( permissionsAsInt >= 0 ) {
                    try {
                        sftp.chmod( permissionsAsInt, abspath );
                    }
                    catch ( SftpException e ) {
                        throw new IOException( "Could change permission on created directory", e );
                    }
                }
            }
        } );
        */

        throw new UnsupportedOperationException();
    }