Function: convert-standard-filename
convert-standard-filename is a byte-compiled function defined in
files.el.gz.
Signature
(convert-standard-filename FILENAME)
Documentation
Convert a standard file's name to something suitable for the OS.
This means to guarantee valid names and perhaps to canonicalize certain patterns.
FILENAME should be an absolute file name since the conversion rules sometimes vary depending on the position in the file name. E.g. c:/foo is a valid DOS file name, but c:/bar/c:/foo is not.
This function's standard definition is trivial; it just returns the argument. However, on Windows and DOS, replace invalid characters. On DOS, make sure to obey the 8.3 limitations. In the native Windows build, turn Cygwin names into native names.
See Info node (elisp)Standard File Names for more details.
Probably introduced at or before Emacs version 19.31.
Aliases
ediff-convert-standard-filename (obsolete since 28.1)
Source Code
;; Defined in /usr/src/emacs/lisp/files.el.gz
(defun convert-standard-filename (filename)
"Convert a standard file's name to something suitable for the OS.
This means to guarantee valid names and perhaps to canonicalize
certain patterns.
FILENAME should be an absolute file name since the conversion rules
sometimes vary depending on the position in the file name. E.g. c:/foo
is a valid DOS file name, but c:/bar/c:/foo is not.
This function's standard definition is trivial; it just returns
the argument. However, on Windows and DOS, replace invalid
characters. On DOS, make sure to obey the 8.3 limitations.
In the native Windows build, turn Cygwin names into native names.
See Info node `(elisp)Standard File Names' for more details."
(cond
((eq system-type 'cygwin)
(let ((name (copy-sequence filename))
(start 0))
;; Replace invalid filename characters with !
(while (string-match "[?*:<>|\"\000-\037]" name start)
(aset name (match-beginning 0) ?!)
(setq start (match-end 0)))
name))
((eq system-type 'windows-nt)
(w32-convert-standard-filename filename))
((eq system-type 'ms-dos)
(dos-convert-standard-filename filename))
(t filename)))