Commits

uniqx committed 165fcef

bookmaak dir in user home directory

Comments (0)

Files changed (2)

src/main/server/conf.bookmaak.js

 
 
+
+Conf = function(){};
+
 /**
  * srv.bookmaak_dir = string
 **/
 
-var bookmaak_dir = '~/.bookmaak'
+Conf.prototype.bookmaak_dir = '~/.bookmaak';
+
+
+
+
+module.exports = new Conf();

src/main/server/srv.js

 var path = require('path');
 
 var conf = require(__dirname+'/conf.bookmaak.js');
-const BASE_DIR = './.bookmaak';
+
+const BASE_DIR = conf.bookmaak_dir.replace('~',process.env.HOME);
+//console.log(BASE_DIR+' <- BASE_DIR');
+
+// create basedir if it does not exist
+if( !path.existsSync(BASE_DIR) ){
+  fs.mkdirSync(BASE_DIR, 0700);
+}
 
 /**
  * srv.url_fix(url) -> string