pub fn build_name<P: AsRef<Path> + Debug>(config_file: P, dir: Option<P>) -> PathBuf {
        let mut snapshot_file = PathBuf::new();
        let parent = config_file
            .as_ref()
            .parent()
            .unwrap_or_else(|| Path::new("."));
        let file_name_without_ext = config_file
            .as_ref()
            .file_stem()
            .expect("fatal error: file_stem() is None");

        // if dir is specified, use this dir to build the final snapshot file name
        // if not, use the same directory as path, and add .json as extension
        match dir {
            Some(dir) => {
                debug_assert!(dir.as_ref().is_dir());
                snapshot_file.push(dir);
                snapshot_file.push(file_name_without_ext);
                snapshot_file.set_extension("json");
            }
            None => {
                snapshot_file.push(parent);
                snapshot_file.push(file_name_without_ext);
                snapshot_file.set_extension("json");
            }
        };

        snapshot_file
    }
/// Builds a new snapshot file name from `path`.
Builds a new snapshot file name from `path`.
Builds a new snapshot file name from ` path ` .
pub fn build_name<P: AsRef<Path> + Debug>(config_file: P, dir: Option<P>) -> PathBuf {
        let mut snapshot_file = PathBuf::new();
        let parent = config_file
            .as_ref()
            .parent()
            .unwrap_or_else(|| Path::new("."));
        let file_name_without_ext = config_file
            .as_ref()
            .file_stem()
            .expect("fatal error: file_stem() is None");
        // if dir is specified, use this dir to build the final snapshot file name
        // if not, use the same directory as path, and add .json as extension
        match dir {
            Some(dir) => {
                debug_assert!(dir.as_ref().is_dir());
                snapshot_file.push(dir);
                snapshot_file.push(file_name_without_ext);
                snapshot_file.set_extension("json");
            }
            None => {
                snapshot_file.push(parent);
                snapshot_file.push(file_name_without_ext);
                snapshot_file.set_extension("json");
            }
        };
        snapshot_file
    }
pub fn build_name < P : AsRef < Path > + Debug > ( config_file : P , dir : Option < P > ) -> PathBuf { let mut snapshot_file = PathBuf :: new ( ) ; let parent = config_file . as_ref ( ) . parent ( ) . unwrap_or_else ( | | Path :: new ( " " ) ) ; let file_name_without_ext = config_file . as_ref ( ) . file_stem ( ) . expect ( " " ) ; // if dir is specified, use this dir to build the final snapshot file name // if not, use the same directory as path, and add .json as extension match dir { Some ( dir ) => { debug_assert ! ( dir as_ref ( ) is_dir ( ) ) ; snapshot_file . push ( dir ) ; snapshot_file . push ( file_name_without_ext ) ; snapshot_file . set_extension ( " " ) ; } None => { snapshot_file . push ( parent ) ; snapshot_file . push ( file_name_without_ext ) ; snapshot_file . set_extension ( " " ) ; } } ; snapshot_file }
Builds a new snapshot file name from `path`.
Builds a new snapshot file name from ` path ` .
config_file
P
dir
Option<P>
config_file
P
dir
Option<P>