Merge pull request #3442 from ethcore/lenient-dirs
Create directories only if feature is enabled
This commit is contained in:
commit
db518ecdd4
@ -117,7 +117,7 @@ fn execute_import(cmd: ImportBlockchain) -> Result<String, String> {
|
||||
let panic_handler = PanicHandler::new_in_arc();
|
||||
|
||||
// create dirs used by parity
|
||||
try!(cmd.dirs.create_dirs());
|
||||
try!(cmd.dirs.create_dirs(false, false));
|
||||
|
||||
// load spec file
|
||||
let spec = try!(cmd.spec.spec());
|
||||
@ -263,7 +263,7 @@ fn execute_export(cmd: ExportBlockchain) -> Result<String, String> {
|
||||
let panic_handler = PanicHandler::new_in_arc();
|
||||
|
||||
// create dirs used by parity
|
||||
try!(cmd.dirs.create_dirs());
|
||||
try!(cmd.dirs.create_dirs(false, false));
|
||||
|
||||
let format = cmd.format.unwrap_or_default();
|
||||
|
||||
|
@ -44,11 +44,15 @@ impl Default for Directories {
|
||||
}
|
||||
|
||||
impl Directories {
|
||||
pub fn create_dirs(&self) -> Result<(), String> {
|
||||
pub fn create_dirs(&self, dapps_enabled: bool, signer_enabled: bool) -> Result<(), String> {
|
||||
try!(fs::create_dir_all(&self.db).map_err(|e| e.to_string()));
|
||||
try!(fs::create_dir_all(&self.keys).map_err(|e| e.to_string()));
|
||||
if signer_enabled {
|
||||
try!(fs::create_dir_all(&self.signer).map_err(|e| e.to_string()));
|
||||
}
|
||||
if dapps_enabled {
|
||||
try!(fs::create_dir_all(&self.dapps).map_err(|e| e.to_string()));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<(), String> {
|
||||
raise_fd_limit();
|
||||
|
||||
// create dirs used by parity
|
||||
try!(cmd.dirs.create_dirs());
|
||||
try!(cmd.dirs.create_dirs(cmd.dapps_conf.enabled, cmd.signer_conf.enabled));
|
||||
|
||||
// load spec
|
||||
let spec = try!(cmd.spec.spec());
|
||||
|
Loading…
Reference in New Issue
Block a user