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:
parent
63f52dad9e
commit
c76d038b8e
11
core/boot.js
11
core/boot.js
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user