Returns a unique file path. @param exp exported names @param file file path @return unique path
(final HashSet<String> exp, final String file)
| 168 | * @return unique path |
| 169 | */ |
| 170 | private static IOFile unique(final HashSet<String> exp, final String file) { |
| 171 | int c = 1; |
| 172 | String path = file; |
| 173 | while(exp.contains(path)) { |
| 174 | path = file.indexOf('.') == -1 ? file + '(' + ++c + ')' : |
| 175 | file.replaceAll("(.*)\\.(.*)", "$1(" + ++c + ").$2"); |
| 176 | } |
| 177 | exp.add(path); |
| 178 | return new IOFile(path); |
| 179 | } |
| 180 | } |