Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 1f3b9383 authored by echicken's avatar echicken 🐔

Don't shit pants if 'cwd' isn't a thing or a string.

Added xjs_eval(filename, str)
- notionally for evaluating XJS without immediate write
- if str, returns the evaluated script as a string
- if !str, returns the filename that the script was dumped to
- was a fun idea, but doesn't play well with other scripts
- best used with simple and self-contained xjs
parent bde3b59e
function xjs_compile(filename) {
if(cwd != '') {
if(typeof cwd == 'string' && cwd != '') {
if(filename.search(/^((\/)|([A-Za-z]:[\/\\]))/)==-1)
filename=cwd+filename;
}
......@@ -91,3 +91,29 @@ function xjs_compile(filename) {
}
return(ssjs_filename);
}
function xjs_eval(filename, str) {
const ssjs = xjs_compile(filename);
const f = new File(filename + '.html');
if (!f.open('w+', false)) {
log(LOG_ERR, "!ERROR " + f.error + " creating " + f.name);
return '';
}
function write(s) {
f.write(s);
}
function writeln(s) {
f.writeln(s);
}
load(ssjs);
if (str) {
f.rewind();
const ret = f.read();
f.close();
f.remove();
return ret;
} else {
f.close();
return filename + '.html';
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment