fn is_lock_newer_than_binary(target_dir: String) -> bool {
    let lock_file = fs::metadata("js/package-lock.json");
    if let Err(_err) = lock_file {
        return true;
    }
    let lock_file = lock_file.unwrap();

    let binary_file = fs::metadata(format!("{}/osgood", target_dir));
    // let binary_file = fs::metadata("target/debug/osgood");
    if let Err(_err) = binary_file {
        return true;
    }
    let binary_file = binary_file.unwrap();

    if let Ok(lock_time) = lock_file.modified() {
        if let Ok(binary_time) = binary_file.modified() {
            return lock_time > binary_time;
        } else {
            return true;
        }
    } else {
        return true;
    }
}
// This prevents `cargo build` from always running `npm install`
This prevents `cargo build` from always running `npm install`
This prevents ` cargo build ` from always running ` npm install `
fn is_lock_newer_than_binary(target_dir: String) -> bool {
    let lock_file = fs::metadata("js/package-lock.json");
    if let Err(_err) = lock_file {
        return true;
    }
    let lock_file = lock_file.unwrap();
    let binary_file = fs::metadata(format!("{}/osgood", target_dir));
    // let binary_file = fs::metadata("target/debug/osgood");
    if let Err(_err) = binary_file {
        return true;
    }
    let binary_file = binary_file.unwrap();
    if let Ok(lock_time) = lock_file.modified() {
        if let Ok(binary_time) = binary_file.modified() {
            return lock_time > binary_time;
        } else {
            return true;
        }
    } else {
        return true;
    }
}
fn is_lock_newer_than_binary ( target_dir : String ) -> bool { let lock_file = fs :: metadata ( " " ) ; if let Err ( _err ) = lock_file { return true ; } let lock_file = lock_file . unwrap ( ) ; let binary_file = fs :: metadata ( format ! ( " " target_dir ) ) ; // let binary_file = fs::metadata("target/debug/osgood"); if let Err ( _err ) = binary_file { return true ; } let binary_file = binary_file . unwrap ( ) ; if let Ok ( lock_time ) = lock_file . modified ( ) { if let Ok ( binary_time ) = binary_file . modified ( ) { return lock_time > binary_time ; } else { return true ; } } else { return true ; } }
This prevents `cargo build` from always running `npm install`
This prevents ` cargo build ` from always running ` npm install `
target_dir
String
target_dir
String