Subject: bug#62435: [PATCH] 29.0 Fix eww--download-directory on MS-Windows

From: lux <[email-masked]>
Date: Sat, 25 Mar 2023 21:42:44 +0800

On Sat, 2023-03-25 at 16:25 +0300, Eli Zaretskii wrote:
> 
> 
> I think the right fix here is to make this directory a defcustom, and
> leave its default value at "~/Downloads" on all systems.
> 

Thank you, I changed it.
From 6496142bf6b1e558ac4fbafa7b977fbfb24d2237 Mon Sep 17 00:00:00 2001
From: Xi Lu <[email-masked]>
Date: Sat, 25 Mar 2023 21:38:48 +0800
Subject: [PATCH] Add `eww-default-download-directory'.

* lisp/net/eww.el: Add variable `eww-default-download-directory'.
---
 lisp/net/eww.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 859a9b44bcb..8a511ecf39e 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -64,16 +64,22 @@ eww-use-browse-url
   :version "28.1"
   :type 'regexp)
 
+(defcustom eww-default-download-directory "~/Downloads/"
+  "The default directory where downloaded files will be saved."
+  :version "29.0"
+  :group 'eww
+  :type 'string)
+
 (defun eww--download-directory ()
   "Return the name of the download directory.
 If ~/Downloads/ exists, that will be used, and if not, the
 DOWNLOAD XDG user directory will be returned.  If that's
 undefined, ~/Downloads/ is returned anyway."
-  (or (and (file-exists-p "~/Downloads/")
-           "~/Downloads/")
+  (or (and (file-exists-p eww-default-download-directory)
+           eww-default-download-directory)
       (when-let ((dir (xdg-user-dir "DOWNLOAD")))
         (file-name-as-directory dir))
-      "~/Downloads/"))
+      eww-default-download-directory))
 
 (defcustom eww-download-directory 'eww--download-directory
   "Directory where files will downloaded.
-- 
2.39.2