David Davies asked me earlier today, how to get the path to a local file, given the URL for its upstreamed and rendered version. Here's a code-snippet that does it:
local (weblogurl = radio.weblog.getUrl ());
local (relpath = string.delete (url, 1, sizeOf (weblogurl)));
local (f = radio.file.getAbsolutePath (relpath));
That will work fine for an image file, but if you need the path to a rendered file. If you need to convert an .html url back to the correct filepath. Add this extra step:
radio.file.locateFileIgnoringExtension (f, @f);
1:51:46 AM
|
|