Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * mkLocalCfg function,
- * makes a local config directory structure and empty config file.
- * in the form "~/.config/nobjs/nobjs_config.json"
- *
- * @param {mkLocalCfgCallback} cb - The callback that handles the response.
- *
- */
- function mkLocalCfg(cb) {
- //validate root folder exists, if not make it.
- if (!admin.hasHomeConfigDir()) {
- fs.mkdir(os.homedir() + "/.config", "775", function(err) {
- //stop here if you can't make it.
- if (err) {cb(err); return;}
- });
- }
- fs.mkdir(admin.getConfigLocation(false), "775", function(err) {
- //can't make config folder end it here
- if (err) {cb(err); return;}
- //write config file, return null or err on error
- fs.writeFile(admin.getConfigLocation(true), JSON.stringify({blogs: {}}), function(err) {
- if (err) {cb(err); return;}
- cb(null);
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement