blob: f8fe6268f6d52df61ad8a114e58dc6af888cbc9a [file]
import java.io.File;
class Main {
String getParent(String path) {
if (path == null) {
throw new NullPointerException();
}
String path1 = fs.normalize(path);
int prefixLength = fs.prefixLength(path1);
int index = path1.lastIndexOf(File.separatorChar);
if (index < prefixLength) {
if ((prefixLength > 0) && (path1.length() > prefixLength))
return path1.substring(0, prefixLength);
return null;
}
return path1.substring(0, index);
}
}