| 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) { |