in-fs: comment, symlinks
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 02 Oct 2016 15:23:20 +0200
changeset 10976df01fc4aa2
parent 108 bbb9b31255be
child 110 d4e5d65ba7cf
in-fs: comment, symlinks
java/alt2xml-in-fs/src/cz/frantovo/alt2xml/in/fs/Reader.java
     1.1 --- a/java/alt2xml-in-fs/src/cz/frantovo/alt2xml/in/fs/Reader.java	Sun Oct 02 15:22:06 2016 +0200
     1.2 +++ b/java/alt2xml-in-fs/src/cz/frantovo/alt2xml/in/fs/Reader.java	Sun Oct 02 15:23:20 2016 +0200
     1.3 @@ -89,7 +89,7 @@
     1.4  		addAttribute(attributes, name, value);
     1.5  		return attributes;
     1.6  	}
     1.7 -	
     1.8 +
     1.9  	private Attributes singleAttribute(String name, String value) {
    1.10  		AttributesImpl attributes = new AttributesImpl();
    1.11  		addAttribute(attributes, name, value);
    1.12 @@ -184,7 +184,7 @@
    1.13  
    1.14  	private void outputPermissions(Path path) throws IOException, SAXException {
    1.15  		level++;
    1.16 -		Set<PosixFilePermission> permissions = Files.getPosixFilePermissions(path, LinkOption.NOFOLLOW_LINKS);
    1.17 +		Set<PosixFilePermission> permissions = Files.getPosixFilePermissions(path); // TODO: maybe symlinks: LinkOption.NOFOLLOW_LINKS
    1.18  
    1.19  		contentHandler.indentation(level);
    1.20  		contentHandler.startElement(null, PERMISSIONS_ELEMENT, PERMISSIONS_ELEMENT, singleAttribute("octal", getOctal(permissions)));
    1.21 @@ -207,15 +207,15 @@
    1.22  
    1.23  	private int getOctal(Set<PosixFilePermission> permissions) {
    1.24  		int octal = 0;
    1.25 -		
    1.26 +
    1.27  		octal = octal + 100 * (permissions.contains(PosixFilePermission.OWNER_READ) ? 4 : 0);
    1.28  		octal = octal + 100 * (permissions.contains(PosixFilePermission.OWNER_WRITE) ? 2 : 0);
    1.29  		octal = octal + 100 * (permissions.contains(PosixFilePermission.OWNER_EXECUTE) ? 1 : 0);
    1.30 -		
    1.31 +
    1.32  		octal = octal + 10 * (permissions.contains(PosixFilePermission.GROUP_READ) ? 4 : 0);
    1.33  		octal = octal + 10 * (permissions.contains(PosixFilePermission.GROUP_WRITE) ? 2 : 0);
    1.34  		octal = octal + 10 * (permissions.contains(PosixFilePermission.GROUP_EXECUTE) ? 1 : 0);
    1.35 -		
    1.36 +
    1.37  		octal = octal + 1 * (permissions.contains(PosixFilePermission.OTHERS_READ) ? 4 : 0);
    1.38  		octal = octal + 1 * (permissions.contains(PosixFilePermission.OTHERS_WRITE) ? 2 : 0);
    1.39  		octal = octal + 1 * (permissions.contains(PosixFilePermission.OTHERS_EXECUTE) ? 1 : 0);