Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Don't use temp folder name in output folder path #394

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Changes from all commits
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
6 changes: 4 additions & 2 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,22 @@ pub fn handle_example_run_command(name: &str) -> Result<()> {

// Creates temporary directory
let temp_dir = TempDir::new().context("Failed to create temporary directory.")?;
let temp_path = temp_dir.path().join(name);
fs::create_dir(&temp_path)?;

// Copies the contents of the subdirectory to the temporary directory
for entry in sub_dir.entries() {
match entry {
DirEntry::Dir(_) => panic!("Subdirectories in examples not supported"),
DirEntry::File(f) => {
let file_name = f.path().file_name().unwrap();
let file_path = temp_dir.path().join(file_name);
let file_path = temp_path.join(file_name);
fs::write(&file_path, f.contents())?;
}
}
}

handle_run_command(temp_dir.path())
handle_run_command(&temp_path)
}

/// Handle the `example list` command.
Expand Down