Gets the path of a file in standard form. If it is a directory, the path ends in "/"
(File _file)
| 214 | * in "/" |
| 215 | */ |
| 216 | static public String getPath(File _file) { |
| 217 | String path; |
| 218 | try { |
| 219 | path = _file.getCanonicalPath(); |
| 220 | } catch (Exception exc) { |
| 221 | path = _file.getAbsolutePath(); |
| 222 | } |
| 223 | if (org.opensourcephysics.display.OSPRuntime.isWindows()) { |
| 224 | path = path.replace('\\', '/'); |
| 225 | // Sometimes the system provides c:, sometimes C:\ |
| 226 | int a = path.indexOf(':'); |
| 227 | if (a > 0) { |
| 228 | path = path.substring(0, a).toUpperCase() + path.substring(a); |
| 229 | } |
| 230 | } |
| 231 | if (_file.isDirectory() && !path.endsWith("/")) { //$NON-NLS-1$ |
| 232 | path = path + "/"; //$NON-NLS-1$ |
| 233 | } |
| 234 | return path; |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * Extracts an EJS model (and its resource files) from the given source and then |
no test coverage detected