fn update_data_dir_path_if_needed<P: AsRef<Path>>(
        config: &mut NodeConfig,
        base_path: P,
    ) -> Result<()> {
        if config.base.data_dir_path == Path::new(DISPOSABLE_DIR_MARKER) {
            let dir = TempPath::new();
            dir.create_as_dir().expect("error creating tempdir");
            config.base.data_dir_path = dir.path().to_owned();
            config.base.temp_data_dir = Some(dir);
        }

        if !config.metrics.dir.as_os_str().is_empty() {
            // do not set the directory if metrics.dir is empty to honor the check done
            // in setup_metrics
            config.metrics.dir = config.base.data_dir_path.join(&config.metrics.dir);
        }
        config.storage.dir = config.base.data_dir_path.join(config.storage.get_dir());
        if config.execution.genesis_file_location == DISPOSABLE_DIR_MARKER {
            config.execution.genesis_file_location = config
                .base
                .data_dir_path
                .join("genesis.blob")
                .to_str()
                .unwrap()
                .to_string();
        }
        config.execution.genesis_file_location = base_path
            .as_ref()
            .with_file_name(&config.execution.genesis_file_location)
            .to_str()
            .unwrap()
            .to_string();

        Ok(())
    }
/// Replaces temp marker with the actual path and returns holder to the temp dir.
Replaces temp marker with the actual path and returns holder to the temp dir.
Replaces temp marker with the actual path and returns holder to the temp dir .
fn update_data_dir_path_if_needed<P: AsRef<Path>>(
        config: &mut NodeConfig,
        base_path: P,
    ) -> Result<()> {
        if config.base.data_dir_path == Path::new(DISPOSABLE_DIR_MARKER) {
            let dir = TempPath::new();
            dir.create_as_dir().expect("error creating tempdir");
            config.base.data_dir_path = dir.path().to_owned();
            config.base.temp_data_dir = Some(dir);
        }
        if !config.metrics.dir.as_os_str().is_empty() {
            // do not set the directory if metrics.dir is empty to honor the check done
            // in setup_metrics
            config.metrics.dir = config.base.data_dir_path.join(&config.metrics.dir);
        }
        config.storage.dir = config.base.data_dir_path.join(config.storage.get_dir());
        if config.execution.genesis_file_location == DISPOSABLE_DIR_MARKER {
            config.execution.genesis_file_location = config
                .base
                .data_dir_path
                .join("genesis.blob")
                .to_str()
                .unwrap()
                .to_string();
        }
        config.execution.genesis_file_location = base_path
            .as_ref()
            .with_file_name(&config.execution.genesis_file_location)
            .to_str()
            .unwrap()
            .to_string();
        Ok(())
    }
fn update_data_dir_path_if_needed < P : AsRef < Path > > ( config : & mut NodeConfig , base_path : P , ) -> Result < ( ) > { if config . base . data_dir_path == Path :: new ( DISPOSABLE_DIR_MARKER ) { let dir = TempPath :: new ( ) ; dir . create_as_dir ( ) . expect ( " " ) ; config . base . data_dir_path = dir . path ( ) . to_owned ( ) ; config . base . temp_data_dir = Some ( dir ) ; } if ! config . metrics . dir . as_os_str ( ) . is_empty ( ) { // do not set the directory if metrics.dir is empty to honor the check done // in setup_metrics config . metrics . dir = config . base . data_dir_path . join ( & config . metrics . dir ) ; } config . storage . dir = config . base . data_dir_path . join ( config . storage . get_dir ( ) ) ; if config . execution . genesis_file_location == DISPOSABLE_DIR_MARKER { config . execution . genesis_file_location = config . base . data_dir_path . join ( " " ) . to_str ( ) . unwrap ( ) . to_string ( ) ; } config . execution . genesis_file_location = base_path . as_ref ( ) . with_file_name ( & config . execution . genesis_file_location ) . to_str ( ) . unwrap ( ) . to_string ( ) ; Ok ( ( ) ) }
Replaces temp marker with the actual path and returns holder to the temp dir.
Replaces temp marker with the actual path and returns holder to the temp dir .
config
&mut NodeConfig
base_path
P