Repository navigation
dos_relativepath
Creates a relative path from one file or folder to another. The paths do not have to be fully-qualified, but they must have a common prefix, or the function will fail and return nil.
For example, let the starting point, path_from, be "C:\One\Two\Three", and the ending point, path_to, be "C:\One\Four\Five". The dos_relativepath function will return the relative path from path_from to path_to as: "..\..\Four\Five". Note, you will get the same result if you set path_from to "\One\Two\Three" and path_to to "\One\Four\Five". On the other hand, "C:\One\Two\Three" and "A:\One\Four\Five" do not share a common prefix, and the function will fail. Also note that "\" is not considered a prefix and is ignored. If you set path_from to "\Two\Three", and path_to to "\Four\Five", the function will fail.
(dos_relativepath path_from path_to)
path_from
A string that contains the path that defines the start of the relative path.
path_to
A string that contains the path that defines the endpoint of the relative path.
A string containing a relative path or filename if successful.
nil on error.
Command: (setq x (dos_relativepath "C:\\Program Files\\AutoCAD 2006" "C:\\Drawings\\Xrefs"))
"..\\..\\Drawings\\Xrefs"