API Reference - Utilities
A Note on Filenames
File names in the API may either be the name of a local file on disk or a URL for untitled or remote files.
IsUrl(filename)
Tests whether the given filename is a URL. Use this on filenames obtained from the API to determine how to treat them.
When this returns False, the filename is a local file name.
Otherwise, the filename is a URL in the one of the following forms:
- Untitled buffers use filenames starting with unknown: For example, unknown:untitled-1.py and unknown:Scratch both refer to an unsaved file.
- Remote files and directories use filenames in the form ssh://hostname/path/to/item where hostname is the Identifier in a Remote Host.