MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / getPath

Method getPath

src/org/opensourcephysics/tools/EjsTool.java:216–235  ·  view source on GitHub ↗

Gets the path of a file in standard form. If it is a directory, the path ends in "/"

(File _file)

Source from the content-addressed store, hash-verified

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

Callers 15

doRunEjsMethod · 0.95
extract0Method · 0.45
refreshNodeMethod · 0.45
refreshGUIMethod · 0.45
actionPerformedMethod · 0.45
replaceClonesMethod · 0.45
setTreeSelectionPathMethod · 0.45
setTreeSelectionPathsMethod · 0.45
setSelectedNodeMethod · 0.45
setExpandedNodesMethod · 0.45
loadAllClassesMethod · 0.45

Calls 2

isWindowsMethod · 0.80
getAbsolutePathMethod · 0.45

Tested by

no test coverage detected