Here you can find the source of isRelativePath(String path)
Parameter | Description |
---|---|
path | a parameter |
public static boolean isRelativePath(String path) throws Exception
//package com.java2s; import java.io.File; public class Main { /**/*from w ww . j av a 2 s. c o m*/ * @param path * @return true if path is relative */ public static boolean isRelativePath(String path) throws Exception { String osName = System.getProperty("os.name"); if (osName.toLowerCase().startsWith("linux")) { if (path.startsWith(File.separator)) { return false; } else { return true; } } else if (osName.toLowerCase().startsWith("windows")) { if (path.indexOf(":") != -1) { return false; } else { return true; } } throw new Exception( "isRelativePath - doesn't support " + System.getProperty("os.name") + " operating system"); } }