Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Create directories only if feature is enabled #3442

Merged
merged 1 commit into from
Nov 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions parity/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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();

Expand Down
10 changes: 7 additions & 3 deletions parity/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
try!(fs::create_dir_all(&self.signer).map_err(|e| e.to_string()));
try!(fs::create_dir_all(&self.dapps).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(())
}

Expand Down
2 changes: 1 addition & 1 deletion parity/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down