Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions crates/wkg/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{io::Seek, path::PathBuf};
use std::{fs, io::Seek, path::PathBuf};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please swap out to use tokio::fs since the function is an async one?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for my delayed response. Updated the code as suggest.

Note: the CI is failed as wasm32-wasi is not available now.


use anyhow::{ensure, Context};
use clap::{Args, Parser, Subcommand, ValueEnum};
Expand Down Expand Up @@ -312,7 +312,12 @@ impl GetArgs {

let output_trailing_slash = self.output.as_os_str().to_string_lossy().ends_with('/');
let parent_dir = if output_trailing_slash {
self.output.as_path()
let parent_dir = self.output.as_path();
if !fs::exists(parent_dir)? {
fs::create_dir_all(parent_dir)
.context("Failed to create output dir")?
}
parent_dir
} else {
self.output
.parent()
Expand Down
Loading