(File parentDir)
| 164 | } |
| 165 | |
| 166 | File wordsFolder(File parentDir) { |
| 167 | if (exhaustive != null) { |
| 168 | return wordsFolderExhaust(parentDir); |
| 169 | } |
| 170 | // Still may be other possibilities after this, but if we hit |
| 171 | // this many attempts, we've pretty much exhausted the list. |
| 172 | final int maxAttempts = prefixes.size() * suffixes.size(); |
| 173 | int attempts = 0; |
| 174 | File outgoing; |
| 175 | do { |
| 176 | // Clean up the name in case a user-supplied word list breaks the rules |
| 177 | String name = Sketch.sanitizeName(getPair()); |
| 178 | outgoing = new File(parentDir, name); |
| 179 | attempts++; |
| 180 | if (attempts == maxAttempts) { |
| 181 | //return null; // avoid infinite loop |
| 182 | return wordsFolderExhaust(parentDir); |
| 183 | } |
| 184 | } while (outgoing.exists()); |
| 185 | return outgoing; |
| 186 | } |
| 187 | } |
| 188 | |
| 189 |
no test coverage detected