MCPcopy Index your code
hub / github.com/apache/groovy / searchForGroovyScriptFile

Method searchForGroovyScriptFile

src/main/java/groovy/ui/GroovyMain.java:532–548  ·  view source on GitHub ↗

Search for the script file, doesn't bother if it is named precisely. Tries in this order: - actual supplied name - name.groovy - name.gvy - name.gy - name.gsh @since 2.3.0

(String input)

Source from the content-addressed store, hash-verified

530 * @since 2.3.0
531 */
532 public static File searchForGroovyScriptFile(String input) {
533 String scriptFileName = input.trim();
534 File scriptFile = new File(scriptFileName);
535 // TODO: Shouldn't these extensions be kept elsewhere? What about CompilerConfiguration?
536 // This method probably shouldn't be in GroovyMain either.
537 String[] standardExtensions = {".groovy",".gvy",".gy",".gsh"};
538 int i = 0;
539 while (i < standardExtensions.length && !scriptFile.exists()) {
540 scriptFile = new File(scriptFileName + standardExtensions[i]);
541 i++;
542 }
543 // if we still haven't found the file, point back to the originally specified filename
544 if (!scriptFile.exists()) {
545 scriptFile = new File(scriptFileName);
546 }
547 return scriptFile;
548 }
549
550 /**
551 * Hunt for the script file by calling searchForGroovyScriptFile(String).

Callers 2

huntForTheScriptFileMethod · 0.95
getCodeSourceMethod · 0.95

Calls 2

trimMethod · 0.80
existsMethod · 0.65

Tested by

no test coverage detected