MCPcopy Index your code
hub / github.com/OpenSourcePhysics/osp / getAbsolutePath

Method getAbsolutePath

src/org/opensourcephysics/controls/XML.java:434–455  ·  view source on GitHub ↗

Gets the absolute path of the specified file. @param file the file @return the absolute path, with forward slashes

(File file)

Source from the content-addressed store, hash-verified

432 * @return the absolute path, with forward slashes
433 */
434 public static String getAbsolutePath(File file) {
435 if (file == null) {
436 return null;
437 }
438 String path = forwardSlash(file.getAbsolutePath());
439 int n = path.indexOf("/../"); //$NON-NLS-1$
440 while (n >= 0) {
441 String pre = path.substring(0, n);
442 int m = pre.lastIndexOf("/"); //$NON-NLS-1$
443 if (m < 0)
444 break;
445 String post = path.substring(n + 3);
446 path = pre.substring(0, m) + post;
447 n = path.indexOf("/../"); //$NON-NLS-1$
448 }
449 n = path.indexOf("/./"); //$NON-NLS-1$
450 while (n >= 0) {
451 path = path.substring(0, n) + path.substring(n + 2);
452 n = path.indexOf("/./"); //$NON-NLS-1$
453 }
454 return path;
455 }
456
457 /**
458 * Resolves the name of a file specified relative to a base path.

Callers 15

getAbsolutePathMethod · 0.95
loadObjectMethod · 0.95
saveMethod · 0.95
writeMethod · 0.95
saveXMLMethod · 0.45
fixExtensionMethod · 0.45
saveXMLMethod · 0.45
getJREPathMethod · 0.45
getDefaultSearchPathsMethod · 0.45
savePreferencesMethod · 0.45
getPrefsControlMethod · 0.45

Calls 1

forwardSlashMethod · 0.95

Tested by 7

runMethod · 0.36
dropMethod · 0.36
saveEditorTextToMethod · 0.36
defineZipFilePathMethod · 0.36
createVideoLabelMethod · 0.36
runMethod · 0.36
actionPerformedMethod · 0.36