MCPcopy Create free account
hub / github.com/christophhart/HISE / collectAllScriptFiles

Method collectAllScriptFiles

hi_scripting/scripting/ScriptProcessor.cpp:660–720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

658}
659
660ValueTree FileChangeListener::collectAllScriptFiles(ModulatorSynthChain *chainToExport)
661{
662 Processor::Iterator<JavascriptProcessor> iter(chainToExport);
663
664 ValueTree externalScriptFiles = ValueTree("ExternalScripts");
665
666 while (JavascriptProcessor *sp = iter.getNextProcessor())
667 {
668 if (sp->isConnectedToExternalFile())
669 {
670 const String fileNameReference = sp->getConnectedFileReference();
671
672 bool exists = false;
673
674 for (int j = 0; j < externalScriptFiles.getNumChildren(); j++)
675 {
676 if (externalScriptFiles.getChild(j).getProperty("FileName").toString() == fileNameReference)
677 {
678 exists = true;
679 break;
680 }
681 }
682
683 if (!exists)
684 {
685 String code;
686
687 sp->mergeCallbacksToScript(code);
688
689 ValueTree script("Script");
690 script.setProperty("FileName", fileNameReference, nullptr);
691 script.setProperty("Content", code, nullptr);
692
693 externalScriptFiles.addChild(script, -1, nullptr);
694 }
695 }
696
697 for (int i = 0; i < sp->getNumWatchedFiles(); i++)
698 {
699 File scriptFile = sp->getWatchedFile(i);
700
701 addFileContentToValueTree(sp, externalScriptFiles, scriptFile, chainToExport);
702 }
703
704 Array<File> allScriptFiles;
705
706 auto scriptDirectory = GET_PROJECT_HANDLER(chainToExport).getSubDirectory(ProjectHandler::SubDirectories::Scripts);
707
708 scriptDirectory.findChildFiles(allScriptFiles, File::findFiles, true, "*.js");
709
710 for (auto f : allScriptFiles)
711 {
712 if (HiseDeviceSimulator::fileNameContainsDeviceWildcard(f))
713 {
714 addFileContentToValueTree(sp, externalScriptFiles, f, chainToExport);
715 }
716 }
717 }

Callers

nothing calls this directly

Calls 13

getNextProcessorMethod · 0.80
getNumWatchedFilesMethod · 0.80
getWatchedFileMethod · 0.80
getNumChildrenMethod · 0.45
toStringMethod · 0.45
getPropertyMethod · 0.45
getChildMethod · 0.45
setPropertyMethod · 0.45
addChildMethod · 0.45
getSubDirectoryMethod · 0.45

Tested by

no test coverage detected