Skip to content

Commit

Permalink
🚑 Fix trash dir parent not created on liftoff
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiBardon committed May 29, 2024
1 parent b0cf4ee commit 9472075
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/helpers/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "orangutan-helpers"
version = "0.1.0"
version = "0.1.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
7 changes: 7 additions & 0 deletions src/helpers/src/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,13 @@ pub struct State {
used_profiles: Option<&'static HashSet<String>>,
}

pub fn create_tmp_dir() -> Result<(), Error> {
trace!("Creating temporary directory at <{}>…", TMP_DIR.display());
fs::create_dir_all(TMP_DIR.as_path())?;

Ok(())
}

pub fn trash_outdated_websites() -> Result<State, Error> {
trace!("Trashing outdated websites…");

Expand Down
2 changes: 1 addition & 1 deletion src/orangutan-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "orangutan-server"
version = "0.4.2"
version = "0.4.3"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
9 changes: 5 additions & 4 deletions src/orangutan-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ fn rocket() -> _ {
}

fn liftoff() -> Result<(), Error> {
clone_repository().map_err(Error::WebsiteGenerationError)?;
generate_default_website().map_err(Error::WebsiteGenerationError)?;
create_tmp_dir()?;
clone_repository()?;
generate_default_website()?;
Ok(())
}

Expand Down Expand Up @@ -85,8 +86,8 @@ async fn not_found() -> Result<NamedFile, &'static str> {

#[derive(Debug, thiserror::Error)]
enum Error {
#[error("Website generation error: {0}")]
WebsiteGenerationError(generate::Error),
#[error(transparent)]
WebsiteGenerationError(#[from] generate::Error),
#[error(transparent)]
MainRouteError(#[from] main_route::Error),
#[error("Could not update content: {0}")]
Expand Down

0 comments on commit 9472075

Please sign in to comment.