Java Utililty Methods Root Directory Get

List of utility methods to do Root Directory Get

Description

The list of methods to do Root Directory Get are organized into topic(s).

Method

FilegetRoot()
Returns the root location of the CraftBukkit server.
return new File(".");
StringgetRoot()
get Root
if (root != null)
    root = new File("").getAbsolutePath();
return root;
StringgetRoot()
get Root
try {
    return new File("/").getCanonicalPath();
} catch (final IOException ex) {
    throw new RuntimeException(ex);
StringgetRoot()
get Root
return System.getProperty("user.dir") + String.format("%ssrc%stest%sfiles%s", File.separator,
        File.separator, File.separator, File.separator);
FilegetRoot()
get Root
System.out.print("Detecting OS... ");
final String name = System.getProperty("os.name").toLowerCase();
File root;
if (name.contains("win"))
    root = new File(System.getenv("APPDATA") + File.separator + ".minecraft");
else if (name.contains("mac"))
    root = new File(
            System.getProperty("user.home") + File.separator + "Library/Application Support/minecraft");
...
StringgetRoot()
get Root
if (rootPath == null) {
    try {
        File rootDir = new File(ClassLoader.getSystemClassLoader().getResource(".").toURI().getPath());
        rootPath = rootDir.getAbsolutePath();
        if (rootPath.endsWith("bin")) {
            rootPath = rootPath.substring(0, rootPath.length() - "bin".length());
        } else if (rootPath.endsWith("target" + File.separator + "classes")) {
            rootPath = rootPath.substring(0,
...
FilegetRoot(File child)
get Root
File root = null;
File tmp = child;
root = tmp;
while (tmp != null) {
    root = tmp;
    tmp = tmp.getParentFile();
if ("\\\\".equals(root.getPath())) { 
...
FilegetRoot(File file)
get Root
File parent = file;
while (parent.getParentFile() != null)
    parent = parent.getParentFile();
return parent;
FilegetRoot(File file)
get Root
File tmp = file.getParentFile();
File rtn = null;
for (; tmp != null; rtn = tmp, tmp = tmp.getParentFile())
    ;
return rtn;
FilegetRoot(File file, ArrayList lst)
get Root
if (file != null && lst != null && lst.size() > 0) {
    for (File f : lst) {
        if (file.equals(f)) {
            return f;
    return getRoot(file.getParentFile(), lst);
return null;