Skip to content

Commit

Permalink
Merge pull request #28 from integer32llc/first-watch-assets
Browse files Browse the repository at this point in the history
Ensure the output directory exists before we start watching it
  • Loading branch information
shepmaster authored Sep 24, 2024
2 parents 6ac7968 + 0709e66 commit 5b2333d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ fn do_assets_watch(
) -> Result<(), AssetsWatchError> {
use assets_watch_error::*;

// The directory needs to exist before we can watch it.
std::fs::create_dir_all(&asset_root)
.context(AssetDirectoryCreateSnafu { path: &asset_root })?;

let (tx, rx) = mpsc::channel();

let mut watcher = notify::recommended_watcher(move |evt: notify::Result<notify::Event>| {
Expand Down Expand Up @@ -142,6 +146,9 @@ fn do_assets_watch(
#[derive(Debug, Snafu)]
#[snafu(module)]
enum AssetsWatchError {
#[snafu(display("Could not create the asset directory"))]
AssetDirectoryCreate { source: io::Error, path: PathBuf },

#[snafu(display("Could not create the filesystem watcher"))]
WatcherCreate { source: notify::Error },

Expand Down

0 comments on commit 5b2333d

Please sign in to comment.