N
Nomak
Hello,
i want to test if a file path is relative. Here is code at the moment:
public static boolean isPathRelative(File file) {
String path = file.toString();
// if linux (root)
if (path.startsWith("/") || !path.startsWith("\\"))
return false;
// if windows (UNC, or drive letter)
if (path.startsWith("\\\\") || path.indexOf(":\\") > 0)
return false;
return true;
}
but i don't know how to test the OS i'm running on. Can somebody help me?
TIA
i want to test if a file path is relative. Here is code at the moment:
public static boolean isPathRelative(File file) {
String path = file.toString();
// if linux (root)
if (path.startsWith("/") || !path.startsWith("\\"))
return false;
// if windows (UNC, or drive letter)
if (path.startsWith("\\\\") || path.indexOf(":\\") > 0)
return false;
return true;
}
but i don't know how to test the OS i'm running on. Can somebody help me?
TIA