plugins:vfs_plugins:namespace_identification

A namespace is, literally, a "space of names" - the virtual folder hierarchy provided by your VFS Plugin. When the user executes the Go command (or another internal Opus command), Directory Opus can identify that access to your plugin is needed in two different ways:

  • By matching a filename extension to the list provided by you in the lpszHandleExts field in the VFS_Identify function, or
  • By matching a URL-style prefix to that provided by you in the lpszHandlePrefix field.

If Opus is able to match a filename extension or path prefix in this manner, it will automatically instantiate an instance of your plugin's namespace using the VFS_Create function.

One alternative identification method is the use of the VFS_QueryPath function. If you specify the VFSF_MULTIPLEFORMATS flag in the dwFlags field of the VFSPLUGININFO structure, Opus will call your VFS_QueryPath function whenever an unknown path is presented, to see if you are able to handle it.

BOOL VFS_QueryPath(LPTSTR lpszPath, BOOL fPrefix, LPGUID pGUID)

Directory Opus calls this function, passing it the path or filename extension in question. If fPrefix is set to TRUE, lpszPath will point to a string that begins with a URL-style prefix. If fPrefix is set to FALSE, lpszPath will point to a string containing a filename extension.

Either way, if your plugin is able to handle the path, you should return TRUE from this function. You also need to fill out the supplied pGUID pointer with a GUID to represent this "aspect" of your plugin. This must be different from the GUID you supplied in response to the VFS_Identify function. The GUID you provide here is passed to the VFS_Create function when instantiating your plugin's namespace, and so should use a different GUID for each different type of file or prefix you are able to handle.

As an example, a plugin that handled ZIP files and RAR files would return different GUIDs for .zip and .rar files, as these are different type of archives. However, .jar files (java archives) are really .zip files, and so for .jar files you would return the same GUID as for .zip files, as there is no need for these two file extensions to be treated differently.

If you do not specify the VFSF_MULTIPLEFORMATS flag you do not need to provide a VFS_QueryPath function, and the GUID passed to VFS_Create will be the one you provided in response to the VFS_Identify function.

If you are using the multiple format interface, you may also wish to implement the VFS_GetPrefixList and VFS_GetCapabilities functions, which are described later in this document.