fix open folder
This commit is contained in:
@@ -47,12 +47,14 @@ pub async fn start_download(app: AppHandle, url: String, options: DownloadOption
|
|||||||
let status = if res.is_ok() { "success" } else { "failed" };
|
let status = if res.is_ok() { "success" } else { "failed" };
|
||||||
|
|
||||||
// Add to history
|
// Add to history
|
||||||
|
let output_dir = options.output_path.clone(); // Store the directory user selected
|
||||||
|
|
||||||
let item = HistoryItem {
|
let item = HistoryItem {
|
||||||
id: id_clone,
|
id: id_clone,
|
||||||
title: metadata.title,
|
title: metadata.title,
|
||||||
thumbnail: metadata.thumbnail,
|
thumbnail: metadata.thumbnail,
|
||||||
url: url,
|
url: url,
|
||||||
output_path: format!("{}/", options.output_path), // Rough path, real path is dynamic
|
output_path: output_dir,
|
||||||
timestamp: chrono::Utc::now(),
|
timestamp: chrono::Utc::now(),
|
||||||
status: status.to_string(),
|
status: status.to_string(),
|
||||||
format: options.quality,
|
format: options.quality,
|
||||||
|
|||||||
@@ -67,6 +67,13 @@ async function startDownload() {
|
|||||||
{ title: metadata.value.title, thumbnail: "", id: metadata.value.id } : // Playlist
|
{ title: metadata.value.title, thumbnail: "", id: metadata.value.id } : // Playlist
|
||||||
metadata.value; // Video
|
metadata.value; // Video
|
||||||
|
|
||||||
|
// Output template
|
||||||
|
// IMPORTANT: history item should store the directory, not the full template path
|
||||||
|
// The downloader handles the template appending internally.
|
||||||
|
|
||||||
|
// We need to pass the directory path to the command, which is what options.value.output_path holds.
|
||||||
|
// The downloader.rs logic appends the filename template.
|
||||||
|
|
||||||
const id = await invoke<string>('start_download', {
|
const id = await invoke<string>('start_download', {
|
||||||
url: url.value,
|
url: url.value,
|
||||||
options: options.value,
|
options: options.value,
|
||||||
|
|||||||
Reference in New Issue
Block a user