public static String aggregateScript(List<String> scriptNames, ClassLoader scriptLoader)
            throws URISyntaxException, IOException {
        final StringBuilder aggregatedScript = new StringBuilder();
        for (String scriptName : scriptNames) {
            String scriptNameWithExtension = format("%s.rpt", scriptName);
            Path scriptPath = Paths.get(scriptNameWithExtension);
            scriptNameWithExtension = URI.create(scriptNameWithExtension).normalize().getPath();
            String script = null;

            assert !scriptPath.isAbsolute();

            // resolve relative scripts in local file system
            if (scriptLoader != null) {
                // resolve relative scripts from class loader to support
                // separated specification projects that include Robot scripts only
                URL resource = scriptLoader.getResource(scriptNameWithExtension);
                if (resource != null) {
                    URI resourceURI = resource.toURI();
                    if ("file".equals(resourceURI.getScheme())) {
                        Path resourcePath = Paths.get(resourceURI);
                        script = readScript(resourcePath);
                    } else {
                        try (FileSystem fileSystem = newFileSystem(resourceURI, EMPTY_ENVIRONMENT)) {
                            Path resourcePath = Paths.get(resourceURI);
                            script = readScript(resourcePath);
                        }
                    }
                }
            }

            if (script == null) {
                throw new RuntimeException("Script not found: " + scriptPath);
            }

            aggregatedScript.append(script);
        }
        return aggregatedScript.toString();
    }
public static String aggregateScript ( List < String > scriptNames , ClassLoader scriptLoader ) throws URISyntaxException , IOException { final StringBuilder aggregatedScript = new StringBuilder ( ) ; for ( String scriptName : scriptNames ) { String scriptNameWithExtension = format ( "%s.rpt" , scriptName ) ; Path scriptPath = Paths . get ( scriptNameWithExtension ) ; scriptNameWithExtension = URI . create ( scriptNameWithExtension ) . normalize ( ) . getPath ( ) ; String script = null ; assert ! scriptPath . isAbsolute ( ) ; if ( scriptLoader != null ) { URL resource = scriptLoader . getResource ( scriptNameWithExtension ) ; if ( resource != null ) { URI resourceURI = resource . toURI ( ) ; if ( "file" . equals ( resourceURI . getScheme ( ) ) ) { Path resourcePath = Paths . get ( resourceURI ) ; script = readScript ( resourcePath ) ; } else { try ( FileSystem fileSystem = newFileSystem ( resourceURI , EMPTY_ENVIRONMENT ) ) { Path resourcePath = Paths . get ( resourceURI ) ; script = readScript ( resourcePath ) ; } } } } if ( script == null ) { throw new RuntimeException ( "Script not found: " + scriptPath ) ; } aggregatedScript . append ( script ) ; } return aggregatedScript . toString ( ) ; }
/*
Public static because it is used in test utils