mirror of
https://codeberg.org/postscriptum/snac2nex.git
synced 2026-03-31 13:15:27 +00:00
warn on using reserved chars instead of trim
This commit is contained in:
parent
1df12cee92
commit
9f24a133ed
1 changed files with 6 additions and 6 deletions
12
src/nex.rs
12
src/nex.rs
|
|
@ -22,10 +22,14 @@ impl Nex {
|
|||
pattern: String,
|
||||
user_names: &Vec<String>,
|
||||
) -> Result<Self> {
|
||||
use std::path::MAIN_SEPARATOR;
|
||||
if filename.contains(MAIN_SEPARATOR) {
|
||||
bail!("Filename pattern should not contain `{MAIN_SEPARATOR}` characters!")
|
||||
}
|
||||
// init data export location
|
||||
let target = PathBuf::from_str(&target_dir)?.canonicalize()?;
|
||||
if !target.is_dir() {
|
||||
bail!("Target location is not directory!");
|
||||
bail!("Target location is not directory!")
|
||||
}
|
||||
// init locations for each user
|
||||
let mut users = HashMap::with_capacity(user_names.len());
|
||||
|
|
@ -156,11 +160,7 @@ impl Nex {
|
|||
);
|
||||
|
||||
// save post file
|
||||
p.push(
|
||||
published
|
||||
.format(self.filename.trim_matches(std::path::MAIN_SEPARATOR))
|
||||
.to_string(),
|
||||
);
|
||||
p.push(published.format(&self.filename).to_string());
|
||||
let f = p.to_string_lossy();
|
||||
if fs::exists(&p)? {
|
||||
println!("\t\t\tpost file `{f}` update with new content.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue