I'm looking for a Delphi function which returns the file URL path from the Windows path. Is there something for it built-in in Delphi ?
Example:
Input
C:\Users\Documents\File.txt
Output
file:///C:/Users/Documents/File.txt
Thanks
I'm looking for a Delphi function which returns the file URL path from the Windows path. Is there something for it built-in in Delphi ?
Example:
Input
C:\Users\Documents\File.txt
Output
file:///C:/Users/Documents/File.txt
Thanks
You can use the
UrlCreateFromPath
API function.Here is the example:
Look at
UrlCreateFromPath()
. Note that there are caveats with thefile:
scheme, though. It is not stanardized across platforms. There are multiple formats to represent the same path in different ways, even just under Windows. Since IE4, the Win32 API standardizes on a single format, but other formats still exist.