-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug_paths.html
More file actions
50 lines (47 loc) · 1.85 KB
/
debug_paths.html
File metadata and controls
50 lines (47 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<title>CheerpJ Path Debugger (4.2 Loader)</title>
<script src='https://cjrtnc.leaningtech.com/4.2/loader.js' crossorigin></script>
</head>
<body>
<div id="log" style="font-family: monospace; white-space: pre;">[INIT] 4.2 Loader Mode...</div>
<script>
function log(m) {
const l = document.getElementById('log');
if (l) l.textContent += m + '\n';
console.log(m);
}
async function run() {
log('Initializing CheerpJ...');
try {
await cheerpjInit({ version: 8 });
log('CheerpJ initialized.');
// Wait for cheerpOS to be defined (it usually is after init)
for (let i = 0; i < 10; i++) {
if (typeof cheerpOS !== 'undefined') break;
log('Waiting for cheerpOS...');
await new Promise(r => setTimeout(r, 1000));
}
if (typeof cheerpOS !== 'undefined') {
log('cheerpOS is defined.');
try {
const entries = await cheerpOS.readDir('/app/');
log('/app/ contents: ' + JSON.stringify(entries));
const projectEntries = await cheerpOS.readDir('/app/starsectorquick/');
log('/app/starsectorquick/ contents: ' + JSON.stringify(projectEntries));
} catch (e) {
log('Error listing dirs: ' + e.message);
}
} else {
log('cheerpOS is STILL undefined.');
}
} catch (e) {
log('cheerpjInit failed: ' + e.message);
}
}
run();
</script>
</body>
</html>