Commit b401c342 authored by Efthymia Bika's avatar Efthymia Bika
Browse files

Create ~/.baas/cache dir

parent e2a08d23
......@@ -7,6 +7,7 @@ var BAAS_HOME_DIR = '.baas';
var CLOUDS_CONF_FILE = 'clouds.rc';
var BACKUP_CONF_FILE = 'backups.rc';
var BAAS_LOG_DIR = path.join(get_user_home(), BAAS_HOME_DIR, 'log');
var BAAS_CACHE_DIR = path.join(get_user_home(), BAAS_HOME_DIR, 'cache');
var exec_path = path.dirname(process.execPath);
var CYGWIN_BASH = path.join(exec_path, "cygwin", "bin", "bash.exe");
......@@ -25,7 +26,12 @@ function create_baas_dir() {
// Create conf files under new directory
create_conf_file(CLOUDS_CONF_FILE);
create_conf_file(BACKUP_CONF_FILE);
create_log_dir();
mkdirp(BAAS_LOG_DIR, function(err) {
if(err) console.error(err);
});
mkdirp(BAAS_CACHE_DIR, function(err) {
if(err) console.error(err);
});
});
return;
}
......@@ -35,6 +41,12 @@ function create_baas_dir() {
// Directory found, check for conf files
create_conf_file(CLOUDS_CONF_FILE);
create_conf_file(BACKUP_CONF_FILE);
mkdirp(BAAS_LOG_DIR, function(err) {
if(err) console.error(err);
});
mkdirp(BAAS_CACHE_DIR, function(err) {
if(err) console.error(err);
});
}
});
}
......@@ -75,18 +87,3 @@ function load_data_from_file(filename, callback) {
});
});
}
function create_log_dir() {
fs.stat(BAAS_LOG_DIR, function (err, stats) {
if(err) {
fs.mkdir(BAAS_LOG_DIR, function(error) {
if(error) return console.error(error);
console.log("Successfully created " + BAAS_LOG_DIR);
});
return;
}
if(stats.isFile()) {
return console.error("Failed to create " + BAAS_LOG_DIR + ", File exists.");
}
});
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment