MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / getParent

Method getParent

CodenameOne/src/com/codename1/io/File.java:144–160  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

142 ///
143 /// The parent directory path.
144 public String getParent() {
145
146 if ("file://".equals(path) || "file:///".equals(path) || path.length() == 0) {
147 return null;
148 }
149
150 String out = path;
151 if (out.endsWith("/")) {
152 out = out.substring(0, out.length() - 1);
153 if (out.endsWith("/")) {
154 return null;
155 }
156 }
157 return out.substring(0, out.lastIndexOf('/'));
158
159
160 }
161
162 /// Returns the file object for the parent directory.
163 public File getParentFile() {

Callers 2

getParentFileMethod · 0.95

Calls 6

endsWithMethod · 0.95
substringMethod · 0.95
lengthMethod · 0.95
lastIndexOfMethod · 0.95
equalsMethod · 0.65
lengthMethod · 0.65

Tested by

no test coverage detected