Skip to content

Commit

Permalink
o Java 7 file attributes now work on Windows ( TM )
Browse files Browse the repository at this point in the history
  • Loading branch information
krosenvold committed Jun 27, 2011
1 parent 05b1968 commit e92b185
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ target/
.classpath
.settings/
bin
*.ipr
*.iml
*.iws

Original file line number Diff line number Diff line change
Expand Up @@ -110,26 +110,11 @@ public class Java7Reflector
public static Object getPosixFileAttributes( File file )
throws IOException
{
/* final Path path = file.toPath();
final PosixFileAttributes posixFileAttributes =
Files.readAttributes( path, PosixFileAttributes.class, LinkOption.NOFOLLOW_LINKS );
*/
final Object path = invoke( pathMethod, file );

return invoke( readAttributes, null, path, posixFileAttributes, arr );
}

/*
final UserPrincipal ownerUserPrincipal = posixFileAttributes.owner();
this.userName = ownerUserPrincipal.getName();
this.groupName = posixFileAttributes.group().getName();
final Set<PosixFilePermission> permissions = posixFileAttributes.permissions();
mode = PosixFilePermissions.toString( permissions ).toCharArray();
*/
public static String getOwnerUserName( Object posixFileAttributes )
{
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,17 @@ public static Map<String, PlexusIoResourceAttributes> getFileAttributesByPath( F
boolean includeNumericUserId )
throws IOException
{
if ( Java7Reflector.isJava7() )
{
return getFileAttributesByPathJava7( dir, recursive );
}
if ( !enabledOnCurrentOperatingSystem() )
{
//noinspection unchecked
return Collections.EMPTY_MAP;
}

if ( Java7Reflector.isJava7() )
{
return getFileAttributesByPathJava7( dir, recursive );
}

if ( logger == null )
{
logger = new ConsoleLogger( Logger.LEVEL_INFO, "Internal" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public void testFolderJava7()
throws IOException
{

if (Os.isFamily( Os.FAMILY_WINDOWS ) || Os.isFamily( Os.FAMILY_WIN9X )){
return; // Nothing to do here.
}

URL resource = Thread.currentThread().getContextClassLoader().getResource(
getClass().getName().replace( '.', '/' ) + ".class" );

Expand Down

0 comments on commit e92b185

Please sign in to comment.