MCPcopy Create free account
hub / github.com/davidgiven/luje / calculatePath

Method calculatePath

lib/java/io/File.java:177–201  ·  view source on GitHub ↗
(String dirPath, String name)

Source from the content-addressed store, hash-verified

175 }
176
177 private String calculatePath(String dirPath, String name) {
178 dirPath = fixSlashes(dirPath);
179 if (!name.equals(EMPTY_STRING) || dirPath.equals(EMPTY_STRING)) {
180 // Remove all the proceeding separator chars from name
181 name = fixSlashes(name);
182
183 int separatorIndex = 0;
184 while ((separatorIndex < name.length())
185 && (name.charAt(separatorIndex) == separatorChar)) {
186 separatorIndex++;
187 }
188 if (separatorIndex > 0) {
189 name = name.substring(separatorIndex, name.length());
190 }
191
192 // Ensure there is a separator char between dirPath and name
193 if (dirPath.length() > 0
194 && (dirPath.charAt(dirPath.length() - 1) == separatorChar)) {
195 return dirPath + name;
196 }
197 return dirPath + separatorChar + name;
198 }
199
200 return dirPath;
201 }
202
203 @SuppressWarnings("nls")
204 private void checkURI(URI uri) {

Callers 1

FileMethod · 0.95

Calls 5

fixSlashesMethod · 0.95
equalsMethod · 0.65
lengthMethod · 0.65
charAtMethod · 0.65
substringMethod · 0.45

Tested by

no test coverage detected