MCPcopy Create free account
hub / github.com/benfry/processing4 / wordsFolder

Method wordsFolder

app/src/processing/app/SketchName.java:166–186  ·  view source on GitHub ↗
(File parentDir)

Source from the content-addressed store, hash-verified

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

Callers 1

nextFolderMethod · 0.95

Calls 4

wordsFolderExhaustMethod · 0.95
sanitizeNameMethod · 0.95
getPairMethod · 0.95
sizeMethod · 0.45

Tested by

no test coverage detected