1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-20 18:48:28 +02:00
2018-03-09 17:49:35 +00:00

32 lines
763 B
JavaScript

#!/usr/bin/env node
"use strict";
const spawn = require("child_process").spawn;
const os = require("os");
const fs = require("fs-extra");
const joplinPath = __dirname + "/node_modules/.bin/joplin";
const profileDir = os.homedir() + "/.config/demo-joplin";
const dbFilename = "database.sqlite";
fs.ensureDirSync(profileDir);
if (!fs.pathExistsSync(profileDir + "/" + dbFilename)) {
fs.copySync(__dirname + "/" + dbFilename, profileDir + "/" + dbFilename);
}
const opt = {
cwd: __dirname,
env: (function() {
process.env.NODE_PATH = ".";
return process.env;
})(),
stdio: [process.stdin, process.stdout, process.stderr],
};
const app = spawn(joplinPath, ["--is-demo", "--profile", profileDir], opt);
app.on("close", code => {
process.exit(code);
});