Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From orphanage-0.1.3 To orphanage-0.1.4
2025-02-21
| ||
04:00 | Update rusqlite and rand. check-in: d9acfcb640 user: jan tags: trunk | |
2024-11-22
| ||
14:23 | Release maintenance. check-in: 2b23697533 user: jan tags: orphanage-0.1.4, trunk | |
14:21 | Add 'outdated' functions to fs module, useful for driving dependency rules. check-in: 89ac2f5207 user: jan tags: trunk | |
2024-11-07
| ||
13:37 | Release maintenance. check-in: a4cacdb382 user: jan tags: orphanage-0.1.3, trunk | |
12:47 | Don't deny on lints. check-in: b6a940c489 user: jan tags: trunk | |
Changes to Cargo.toml.
1 2 | [package] name = "orphanage" | | | 1 2 3 4 5 6 7 8 9 10 | [package] name = "orphanage" version = "0.1.4" edition = "2021" license = "0BSD" # https://crates.io/category_slugs categories = [ "network-programming" ] keywords = [ "sqlite", "fs", "path" ] repository = "https://repos.qrnch.tech/pub/orphanage" description = "Random collection of stuff that is still searching for a home." |
︙ | ︙ |
Changes to src/fs.rs.
1 2 3 4 5 6 7 8 9 | use std::{ fs, path::{Path, PathBuf} }; use crate::err::Error; /// Create a random file of a specified size. /// | > | 1 2 3 4 5 6 7 8 9 10 | use std::{ fs, io::ErrorKind, path::{Path, PathBuf} }; use crate::err::Error; /// Create a random file of a specified size. /// |
︙ | ︙ | |||
61 62 63 64 65 66 67 68 | pub fn abspath<P>(pth: P) -> Result<PathBuf, Error> where P: AsRef<Path> { Ok(pth.as_ref().canonicalize()?) } // vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 : | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | pub fn abspath<P>(pth: P) -> Result<PathBuf, Error> where P: AsRef<Path> { Ok(pth.as_ref().canonicalize()?) } /// Call a closure if `outfile` is outdated (according to the rules of /// [`outdated()`] with regards to `infile`. /// /// Returns `Ok(true)` if the closure was called. /// /// # Errors /// Errors mirror the behavior of [`outdated()`]'s errors. pub fn run_if_outdated<F>( srcfile: impl AsRef<Path>, dstfile: impl AsRef<Path>, f: F ) -> Result<bool, std::io::Error> where F: FnOnce(&Path, &Path) { if outdated(&srcfile, &dstfile)? { f(srcfile.as_ref(), dstfile.as_ref()); Ok(true) } else { Ok(false) } } /// Returns `true` if `infile` is newer than `outfile` (or if `outfile` doesn't /// exist). Returns `false` otherwise. /// /// # Errors /// Returns [`std::io::Error`] if: /// - `infile`'s metadata could not be read. /// - `outfile`'s metadata could not be read and it is other than /// `ErrorKind::NotFound`. /// - Either `infile`' or `outfile`'s mtime could not be extracted. pub fn outdated( infile: impl AsRef<Path>, outfile: impl AsRef<Path> ) -> Result<bool, std::io::Error> { let in_md = fs::metadata(infile.as_ref())?; let out_md = match fs::metadata(outfile.as_ref()) { Ok(md) => md, Err(err) if err.kind() == ErrorKind::NotFound => { // If the target file could not be found then treat target as outdated return Ok(true); } Err(e) => Err(e)? }; let in_mtime = in_md.modified()?; let out_mtime = out_md.modified()?; Ok(in_mtime > out_mtime) } // vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 : |
Changes to www/changelog.md.
1 2 3 4 | # Change Log ## [Unreleased] | | > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # Change Log ## [Unreleased] [Details](/vdiff?from=orphanage-0.1.4&to=trunk) ### Added ### Changed ### Removed --- ## [0.1.4] - 2024-11-22 [Details](/vdiff?from=orphanage-0.1.3&to=orphanage-0.1.4) ### Added - `fs::outdated()` can be used to detect of a file is "outdated" with regards to another. - `fs::run_if_outdated()` can be used to run a closure if a file is "outdated" with regards to another. --- ## [0.1.3] - 2024-11-07 [Details](/vdiff?from=orphanage-0.1.2&to=orphanage-0.1.3) ### Added |
︙ | ︙ |