mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-16 06:15:02 -05:00
Refactor and modularize xattr read/write access
This commit is contained in:
parent
5cdf6e4311
commit
61b551a37b
@ -30,10 +30,9 @@ public class ExtAttrView implements XattrView {
|
|||||||
try {
|
try {
|
||||||
return execute("getextattr", "-q", "user", key, path).toString().trim();
|
return execute("getextattr", "-q", "user", key, path).toString().trim();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
debug.finest(e::getMessage);
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void write(String key, String value) throws IOException {
|
public void write(String key, String value) throws IOException {
|
||||||
execute("setextattr", "-q", "user", key, value, path);
|
execute("setextattr", "-q", "user", key, value, path);
|
||||||
|
@ -12,7 +12,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class PlainFileXattrView implements XattrView {
|
public class PlainFileXattrView implements XattrView {
|
||||||
|
|
||||||
public static final String XATTR_FOLDER = System.getProperty("net.filebot.xattr.store", ".xattr");
|
private static final String XATTR_FOLDER = System.getProperty("net.filebot.xattr.store", ".xattr");
|
||||||
|
|
||||||
private final Path folder;
|
private final Path folder;
|
||||||
|
|
||||||
@ -20,10 +20,6 @@ public class PlainFileXattrView implements XattrView {
|
|||||||
folder = path.getParent().resolve(XATTR_FOLDER).resolve(path.getFileName());
|
folder = path.getParent().resolve(XATTR_FOLDER).resolve(path.getFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlainFileXattrView(Path store, Path path) throws IOException {
|
|
||||||
folder = store.resolve(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> list() throws IOException {
|
public List<String> list() throws IOException {
|
||||||
if (Files.isDirectory(folder)) {
|
if (Files.isDirectory(folder)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user