mirror of
https://github.com/corda/corda.git
synced 2024-12-29 09:18:58 +00:00
implement File.getParent()
This commit is contained in:
parent
f72f95d7ca
commit
8b102783a6
@ -33,6 +33,20 @@ public class File {
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getParent() {
|
||||||
|
int index = path.lastIndexOf("/");
|
||||||
|
if (index >= 0) {
|
||||||
|
return path.substring(0, index);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getParentFile() {
|
||||||
|
String s = getParent();
|
||||||
|
return (s == null ? null : new File(s));
|
||||||
|
}
|
||||||
|
|
||||||
private static native String toCanonicalPath(String path);
|
private static native String toCanonicalPath(String path);
|
||||||
|
|
||||||
public String getCanonicalPath() {
|
public String getCanonicalPath() {
|
||||||
|
Loading…
Reference in New Issue
Block a user