MCPcopy Index your code
hub / github.com/codenameone/CodenameOne / locateIndexRoot

Function locateIndexRoot

scripts/run-javascript-lifecycle-tests.mjs:159–170  ·  view source on GitHub ↗

* Walk into the bundle directory and return the directory containing * ``index.html``. Bundle archives wrap the actual content in a * single `` -js/`` folder, so we have to descend.

(root)

Source from the content-addressed store, hash-verified

157 * single ``<App>-js/`` folder, so we have to descend.
158 */
159function locateIndexRoot(root) {
160 if (fs.existsSync(path.join(root, 'index.html'))) {
161 return root;
162 }
163 for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
164 if (!entry.isDirectory()) continue;
165 const sub = path.join(root, entry.name);
166 const found = locateIndexRoot(sub);
167 if (found) return found;
168 }
169 return null;
170}
171
172/**
173 * Spawn ``javascript_browser_harness.py`` to serve the bundle on a

Callers 1

runBundleFunction · 0.85

Calls 2

joinMethod · 0.65
isDirectoryMethod · 0.45

Tested by

no test coverage detected