@ -47,7 +47,6 @@ import java.io.File;
import java.io.IOException ;
import java.io.IOException ;
import java.nio.file.Files ;
import java.nio.file.Files ;
import java.nio.file.LinkOption ;
import java.nio.file.LinkOption ;
import java.nio.file.NoSuchFileException ;
import java.nio.file.Path ;
import java.nio.file.Path ;
import java.nio.file.attribute.BasicFileAttributeView ;
import java.nio.file.attribute.BasicFileAttributeView ;
import java.nio.file.attribute.BasicFileAttributes ;
import java.nio.file.attribute.BasicFileAttributes ;
@ -66,17 +65,6 @@ import org.eclipse.jgit.util.FS.Attributes;
* /
* /
public class FileUtil {
public class FileUtil {
static class Java7BasicAttributes extends Attributes {
Java7BasicAttributes ( FS fs , File fPath , boolean exists ,
boolean isDirectory , boolean isExecutable ,
boolean isSymbolicLink , boolean isRegularFile ,
long creationTime , long lastModifiedTime , long length ) {
super ( fs , fPath , exists , isDirectory , isExecutable , isSymbolicLink ,
isRegularFile , creationTime , lastModifiedTime , length ) ;
}
}
/ * *
/ * *
* @param path
* @param path
* @return target path of the symlink
* @return target path of the symlink
@ -230,7 +218,7 @@ public class FileUtil {
. getFileAttributeView ( nioPath ,
. getFileAttributeView ( nioPath ,
BasicFileAttributeView . class ,
BasicFileAttributeView . class ,
LinkOption . NOFOLLOW_LINKS ) . readAttributes ( ) ;
LinkOption . NOFOLLOW_LINKS ) . readAttributes ( ) ;
Attributes attributes = new FileUtil . Java7Basic Attributes( fs , path ,
Attributes attributes = new Attributes ( fs , path ,
true ,
true ,
readAttributes . isDirectory ( ) ,
readAttributes . isDirectory ( ) ,
fs . supportsExecute ( ) ? path . canExecute ( ) : false ,
fs . supportsExecute ( ) ? path . canExecute ( ) : false ,
@ -242,9 +230,6 @@ public class FileUtil {
. encode ( FileUtils . readSymLink ( path ) ) . length
. encode ( FileUtils . readSymLink ( path ) ) . length
: readAttributes . size ( ) ) ;
: readAttributes . size ( ) ) ;
return attributes ;
return attributes ;
} catch ( NoSuchFileException e ) {
return new FileUtil . Java7BasicAttributes ( fs , path , false , false ,
false , false , false , 0L , 0L , 0L ) ;
} catch ( IOException e ) {
} catch ( IOException e ) {
return new Attributes ( path , fs ) ;
return new Attributes ( path , fs ) ;
}
}
@ -264,7 +249,7 @@ public class FileUtil {
. getFileAttributeView ( nioPath ,
. getFileAttributeView ( nioPath ,
PosixFileAttributeView . class ,
PosixFileAttributeView . class ,
LinkOption . NOFOLLOW_LINKS ) . readAttributes ( ) ;
LinkOption . NOFOLLOW_LINKS ) . readAttributes ( ) ;
Attributes attributes = new FileUtil . Java7Basic Attributes(
Attributes attributes = new Attributes (
fs ,
fs ,
path ,
path ,
true , //
true , //
@ -277,9 +262,6 @@ public class FileUtil {
readAttributes . lastModifiedTime ( ) . toMillis ( ) ,
readAttributes . lastModifiedTime ( ) . toMillis ( ) ,
readAttributes . size ( ) ) ;
readAttributes . size ( ) ) ;
return attributes ;
return attributes ;
} catch ( NoSuchFileException e ) {
return new FileUtil . Java7BasicAttributes ( fs , path , false , false ,
false , false , false , 0L , 0L , 0L ) ;
} catch ( IOException e ) {
} catch ( IOException e ) {
return new Attributes ( path , fs ) ;
return new Attributes ( path , fs ) ;
}
}