In JSFL, there’s two different reference systems – the directory structure and the URI structure. In the documentation, if you want the currently open file’s location they say you can reference
fl.getDocumentDOM().path
this gives you the directory structure. There, however, is no mention of how to get the URI. Some people have built clever find and replace scripts, but there’s an undocumented attribute called
fl.getDocumentDOM().pathURI
that gives you the URI as needed. Hope this helps someone!