mirror of
https://github.com/zyllian/webdog.git
synced 2025-05-10 02:26:42 -07:00
fix builds without serve feature
This commit is contained in:
parent
c0a5d06074
commit
c653c3554e
3 changed files with 13 additions and 13 deletions
12
src/util.rs
12
src/util.rs
|
@ -1,6 +1,6 @@
|
|||
//! Module containing various utilities.
|
||||
|
||||
use std::path::Path;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
/// Simple helper to remove the contents of a directory without removing the directory itself.
|
||||
pub fn remove_dir_contents(path: &Path) -> eyre::Result<()> {
|
||||
|
@ -16,3 +16,13 @@ pub fn remove_dir_contents(path: &Path) -> eyre::Result<()> {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Helper to get the "name" of a path.
|
||||
pub fn get_name(path: &Path) -> (PathBuf, String) {
|
||||
let name = path.with_extension("");
|
||||
let name_str = name
|
||||
.display()
|
||||
.to_string()
|
||||
.replace(std::path::MAIN_SEPARATOR, "/");
|
||||
(name, name_str)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue