all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#62435: [PATCH] 29.0 Fix eww--download-directory on MS-Windows
@ 2023-03-25 11:56 lux
  2023-03-25 13:25 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: lux @ 2023-03-25 11:56 UTC (permalink / raw)
  To: 62435


[-- Attachment #1.1: Type: text/plain, Size: 130 bytes --]

The eww--download-directory hardcodes the download path, so it does not
work on MS-Windows, I fixed it, and tested on MS-Windows.

[-- Attachment #1.2: Type: text/html, Size: 136 bytes --]

[-- Attachment #2: 0001-Fix-eww-download-directory-on-Windows.patch --]
[-- Type: application/octet-stream, Size: 1610 bytes --]

From b4c5ed1d8fee7b69a079ee883344bf483faf7a52 Mon Sep 17 00:00:00 2001
From: Xi Lu <lx@shellcodes.org>
Date: Sat, 25 Mar 2023 14:44:35 +0800
Subject: [PATCH] Fix eww--download-directory on Windows.

* lisp/net/eww.el: Add get the download directory on MS-Windows.
---
 lisp/net/eww.el | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 859a9b44bcb..ac3af4677b5 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -66,14 +66,17 @@ eww-use-browse-url
 
 (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
+If ~/Downloads/ or %USERPROFILE% on Windows 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/")
-      (when-let ((dir (xdg-user-dir "DOWNLOAD")))
-        (file-name-as-directory dir))
-      "~/Downloads/"))
+  (let ((download-dir (if (eq system-type 'windows-nt)
+                          (concat (getenv "USERPROFILE") "\\Downloads\\")
+                        (concat (getenv "HOME") "/Downloads/"))))
+    (or (and (file-exists-p download-dir)
+             download-dir)
+        (when-let ((dir (xdg-user-dir "DOWNLOAD")))
+          (file-name-as-directory dir))
+        download-dir)))
 
 (defcustom eww-download-directory 'eww--download-directory
   "Directory where files will downloaded.
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-03-26 11:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-25 11:56 bug#62435: [PATCH] 29.0 Fix eww--download-directory on MS-Windows lux
2023-03-25 13:25 ` Eli Zaretskii
2023-03-25 13:42   ` lux
2023-03-25 14:05     ` Eli Zaretskii
2023-03-25 14:17       ` lux
2023-03-26 11:59         ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.