pub fn pkgdb_dir() -> Option<PathBuf> {
    if let Ok(lines) = read_lines("/etc/mk.conf") {
        let line = lines.flatten().find(|l| l.starts_with("PKG_DBDIR"));

        if let Some(pkg_dbdir) = line {
            if let Some(value) = pkg_dbdir.split('=').nth(1) {
                return Some(PathBuf::from(value.trim()));
            }
        };
    }

    Some(PathBuf::from("/usr/pkg/pkgdb"))
}
/// Returns the value of PKG_DBDIR if exists or a default if not.
Returns the value of PKG_DBDIR if exists or a default if not.
Returns the value of PKG_DBDIR if exists or a default if not .
pub fn pkgdb_dir() -> Option<PathBuf> {
    if let Ok(lines) = read_lines("/etc/mk.conf") {
        let line = lines.flatten().find(|l| l.starts_with("PKG_DBDIR"));
        if let Some(pkg_dbdir) = line {
            if let Some(value) = pkg_dbdir.split('=').nth(1) {
                return Some(PathBuf::from(value.trim()));
            }
        };
    }
    Some(PathBuf::from("/usr/pkg/pkgdb"))
}
pub fn pkgdb_dir ( ) -> Option < PathBuf > { if let Ok ( lines ) = read_lines ( " " ) { let line = lines . flatten ( ) . find ( | l | l . starts_with ( " " ) ) ; if let Some ( pkg_dbdir ) = line { if let Some ( value ) = pkg_dbdir . split ( '=' ) . nth ( 1 ) { return Some ( PathBuf :: from ( value . trim ( ) ) ) ; } } ; } Some ( PathBuf :: from ( " " ) ) }
Returns the value of PKG_DBDIR if exists or a default if not.
Returns the value of PKG_DBDIR if exists or a default if not .