emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/org-mime 3b119a22be 112/118: handle file url on Windows el


From: ELPA Syncer
Subject: [nongnu] elpa/org-mime 3b119a22be 112/118: handle file url on Windows elegantly
Date: Wed, 5 Jan 2022 07:58:51 -0500 (EST)

branch: elpa/org-mime
commit 3b119a22be0ee22d16773e4d9a26478d3c8bf2df
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>

    handle file url on Windows elegantly
---
 org-mime.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/org-mime.el b/org-mime.el
index c4df091dce..0c6c39a239 100644
--- a/org-mime.el
+++ b/org-mime.el
@@ -363,9 +363,16 @@ Or else use CURRENT-FILE to calculate path."
          (path (expand-file-name url dir)))
     (cond
      ((string-match-p "^file:///" url)
-      (replace-regexp-in-string "^file://" "" url))
+      (let* ((str (replace-regexp-in-string "^file://" "" url)))
+        (when (and (eq system-type 'windows-nt)
+                   (string-match "^/[a-zA-Z]:" str))
+          ;; remove the first character from "/C:/Windows/File.txt"
+          (setq str (substring str 1)))
+        str))
+
      ((file-exists-p path)
       path)
+
      (t
       (expand-file-name url default-directory)))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]