1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Update command line processing to allow a wiki path to be specified

This commit is contained in:
Jeremy Ruston 2013-02-09 17:07:18 +00:00
parent 63f52dad9e
commit c76d038b8e
2 changed files with 11 additions and 2 deletions

View File

@ -404,7 +404,16 @@ if(!$tw.browser) {
// System paths and filenames
$tw.boot.bootFile = path.basename(module.filename);
$tw.boot.bootPath = path.dirname(module.filename);
$tw.boot.wikiPath = process.cwd();
// If the first command line argument doesn't start with `--` then we
// interpret it as the path to the wiki folder, which will otherwise default
// to the current folder
$tw.boot.argv = Array.prototype.slice.call(process.argv,2);
if($tw.boot.argv[0] && $tw.boot.argv[0].indexOf("--") !== 0) {
$tw.boot.wikiPath = $tw.boot.argv[0];
$tw.boot.argv = $tw.boot.argv.slice(1);
} else {
$tw.boot.wikiPath = process.cwd();
}
// Read package info
$tw.packageInfo = JSON.parse(fs.readFileSync($tw.boot.bootPath + "/../package.json"));
// Check node version number

View File

@ -130,7 +130,7 @@ exports.startup = function() {
} else {
// On the server, start a commander with the command line arguments
commander = new $tw.Commander(
Array.prototype.slice.call(process.argv,2),
$tw.boot.argv,
function(err) {
if(err) {
console.log("Error: " + err);