Skip to content

misterdownloadmanager: The ultimate open-source, clean-room download manager written from scratch in pure Rust for Windows, Mac, and Linux

Download video remembers the folder you save into (#475) (#495)

Ahmed Nefzaouic8c487762823
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3ae83d06..220cd7e7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,9 +7,11 @@ Each release's notes on GitHub come from its section here (`## [X.Y.Z]`, see
### Fixed
+- The **Download video** window remembers the folder you save into, per **Options → Save to**'s "Change folder for this category on last selected", as **Download File Info** does: it no longer goes back to the Video category's folder each time ([#475](https://github.com/anefzaoui/misterdownloadmanager/issues/475)).
- X (Twitter) videos sent from the browser's media list are named after the tab, not the random name of their file on X's video server ([#493](https://github.com/anefzaoui/misterdownloadmanager/issues/493)).
- Windows: **Open folder** on a download opens the folder with the file manager set up to open folders (Directory Opus, for example), instead of always starting Windows Explorer. With Explorer it still selects the file ([#446](https://github.com/anefzaoui/misterdownloadmanager/issues/446)).
+
## [0.5.2] - 2026-11-09
A big fixes release: YouTube and video downloads, crashes and freezes, downloads on slow disks, the Mac helper, plus a Safari extension, far more file types and a few new columns and options.
diff --git a/ROADMAP.md b/ROADMAP.md
index a503db70..ee16f695 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -524,6 +524,8 @@ These ship in a later version, when they're ready.
([#457](https://github.com/anefzaoui/misterdownloadmanager/pull/457))
- 🔄 Download File Info staying open but invisible, with later browser downloads waiting behind
it ([#440](https://github.com/anefzaoui/misterdownloadmanager/issues/440)): fix in review
+- 🔄 The Download video window not remembering the folder you saved into
+ ([#475](https://github.com/anefzaoui/misterdownloadmanager/issues/475)): fix in review
- 🔄 Arabic and other non-Latin file names saved unreadable, from Firefox and browsers built on it
([#447](https://github.com/anefzaoui/misterdownloadmanager/issues/447)): fix in review
- 🔄 A file renamed to avoid a clash still showing and opening under its old name
diff --git a/crates/app/src/app.rs b/crates/app/src/app.rs
index 53f23070..2be1272c 100644
--- a/crates/app/src/app.rs
+++ b/crates/app/src/app.rs
@@ -1458,10 +1458,9 @@ impl App {
fn add(&mut self, fi: &mut FileInfo, start: Start) {
// Only a folder other than the category's becomes its new one (an unchanged folder
// stays "the default", following Downloads).
- if let Some((cat, dir)) = fi.remembered()
- && std::path::Path::new(&dir) != self.settings.category_dir(cat, &self.downloads)
- {
- self.settings.set_category_dir(cat, Some(dir));
+ if let Some((cat, dir)) = fi.remembered() {
+ self.settings
+ .keep_category_dir(cat, std::path::Path::new(&dir), &self.downloads);
}
let id = self.push_item(
fi.url.clone(),
@@ -1528,10 +1527,9 @@ impl App {
/// Download File Info closed with Start / Later on a download that started early.
fn adopt_early(&mut self, fi: &FileInfo, id: u64, start: Start) {
- if let Some((cat, dir)) = fi.remembered()
- && std::path::Path::new(&dir) != self.settings.category_dir(cat, &self.downloads)
- {
- self.settings.set_category_dir(cat, Some(dir));
+ if let Some((cat, dir)) = fi.remembered() {
+ self.settings
+ .keep_category_dir(cat, std::path::Path::new(&dir), &self.downloads);
}
let dest = fi.dest();
let now = matches!(start, Start::Now);
@@ -8388,6 +8386,17 @@ impl App {
Outcome::Open => {}
Outcome::Closed => self.video_dlg = None,
Outcome::Done(out) => {
+ // Options' "Change folder for this category on last selected", which
+ // Download File Info follows through its box (#475).
+ if self.settings.change_folder_on_last
+ && self.settings.keep_category_dir(
+ Category::Video,
+ &v.save_folder(),
+ &self.downloads,
+ )
+ {
+ self.dirty = true;
+ }
self.video_dlg = None;
match out {
crate::videodlg::VideoOut::One(add) => self.add_video(add),
diff --git a/crates/app/src/settings.rs b/crates/app/src/settings.rs
index 2bf5a52c..db5e1ac9 100644
--- a/crates/app/src/settings.rs
+++ b/crates/app/src/settings.rs
@@ -785,6 +785,21 @@ impl Settings {
}
}
+ /// The folder just saved into becomes the category's, when it is another one (an unchanged
+ /// folder stays "the default", following Downloads). True when the folder changed.
+ pub fn keep_category_dir(
+ &mut self,
+ cat: crate::model::Category,
+ dir: &std::path::Path,
+ downloads: &std::path::Path,
+ ) -> bool {
+ if dir.as_os_str().is_empty() || dir == self.category_dir(cat, downloads) {
+ return false;
+ }
+ self.set_category_dir(cat, Some(dir.display().to_string()));
+ true
+ }
+
/// Both category registries (the user's and the built-in ones' edits) from these settings,
/// for code that only has a `Category`.
pub fn publish_categories(&self) {
@@ -1000,6 +1015,29 @@ pub fn own_net() -> mdm_engine::Options {
#[cfg(test)]
mod tests {
+ use std::path::Path;
+
+ /// #475: a folder chosen for a video is the Video category's next time; the category's own
+ /// folder stays "the default", following Downloads, and other categories stay as they were.
+ #[test]
+ fn a_folder_saved_into_becomes_the_categorys() {
+ use crate::model::Category;
+ let root = std::env::temp_dir();
+ let downloads = root.join("Downloads");
+ let downloads = downloads.as_path();
+ let mut s = super::Settings::default();
+ let default_video = s.category_dir(Category::Video, downloads);
+ assert!(!s.keep_category_dir(Category::Video, &default_video, downloads));
+ assert!(s.category_dirs.is_empty(), "the default stays the default");
+ assert!(!s.keep_category_dir(Category::Video, Path::new(""), downloads));
+ let chosen = root.join("clips");
+ let chosen = chosen.as_path();
+ assert!(s.keep_category_dir(Category::Video, chosen, downloads));
+ assert_eq!(s.category_dir(Category::Video, downloads), chosen);
+ assert_ne!(s.category_dir(Category::Music, downloads), chosen);
+ assert!(!s.keep_category_dir(Category::Video, chosen, downloads));
+ }
+
#[test]
fn a_dialog_keeps_what_changed_elsewhere_meanwhile() {
let from = super::Settings::default();
diff --git a/crates/app/src/videodlg.rs b/crates/app/src/videodlg.rs
index 7d91341d..bc1d670e 100644
--- a/crates/app/src/videodlg.rs
+++ b/crates/app/src/videodlg.rs
@@ -442,6 +442,11 @@ impl VideoDialog {
}
}
+ /// The Save to folder: the one a playlist's own folder goes under, too.
+ pub fn save_folder(&self) -> PathBuf {
+ crate::dialogs::resolve_path(&self.folder)
+ }
+
fn name_from_choice(&mut self) {
if let Some((v, choices)) = &self.video
&& let Some(c) = choices.get(self.chosen)