[英]How to get windows path with backslash from elisp
我正在使用emacs在Windows上嘗試一些東西。 在我的情況下,我需要從elisp返回反斜杠的文件路徑。 但是elisp總是以斜線等方式返回路徑。
(expand-file-name "text.log" "d:\\ProgramData\\temp")
=> d:/ProgramData/temp/text.log
我的要求:
(expand-file-name "text.log" "d:\\ProgramData\\temp")
=> d:\ProgramData\temp\text.log
它可以用regexp完成,但我需要更簡單的方法。
(elisp) Standard File Names
convert-standard-filename
中的convert-standard-filename
是否符合您的需要?
當然(subst-char-in-string ?/ ?\\\\ <file>)
應該可以解決問題。 但請注意,斜杠在Windows中幾乎無處不在(我知道唯一不支持它們的工具是默認的“shell”(command.com,cmd.exe,或者其他一些名稱))所以也許你甚至都沒有需要這種轉換。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.