Many functions in the VFS Plugin API are defined as type BOOL. Generally, this means they simply return TRUE (1) on success, or FALSE (0) on failure.
If a function fails for any reason, it should return FALSE, and indicate the reason for failure via the VFS_GetLastError function. Similar to the Windows GetLastError function, VFS_GetLastError is called by Directory Opus to retrieve the reason for the last error that occurred in the plugin namespace.
The error code that you return can be any of the standard Windows error codes (eg; ERROR_FILE_NOT_FOUND), or it can be one of a number of defined Opus-specific error codes. The following is a list of the currently defined codes and the error message shown to the user when they occur. Generally you should use one of the standard Windows error codes to indicate the reason for failure. Many (most) of the Opus-only error codes are specific to internal Opus functionality and do not have much relevance to VFS plugins, however they are presented here for completeness.
| VFSERR_COPY_INTO_ITSELF | You can't copy or move a folder into itself. |
| VFSERR_NOT_SUPPORTED | The operation is not supported by this VFS. |
| VFSERR_MOVE_INTO_SAMEDIR | Source and destination must be different to move files. |
| VFSERR_DIR_ALREADY_EXISTS | Cannot create a folder when that folder already exists. |
| VFSERR_FILE_IS_DIR | File is really a folder. |
| VFSERR_BADLINK | Link does not point to a valid file. |
| VFSERR_NOTEXPORTFILE | File is not a valid exported Preferences file. |
| VFSERR_NORECYCLEBIN | Object can not be placed in the recycle bin and will be permanently deleted. |
| VFSERR_RECYCLETOOBIG | Object is too large to be placed in the recycle bin and will be permanently deleted. |
| VFSERR_NOPRINTHANDLER | File does not have a registered Print handler. |
| VFSERR_BADZIPFILE | Zip Compressed File is invalid or damaged. |
| VFSERR_GENERALERRMSG | General error. |
| VFSERR_WRITEPROTECTED | The disk is write protected. |
| VFSERR_WRITEPROTECTEDZIP | The Zip Compressed File is write protected. |
| VFSERR_ZIPISDIR | A folder already exists by that name. |
| VFSERR_CANTRENAMEFOLDERS | Folders cannot be renamed within ZIP files. |
| VFSERR_SHARINGVIOLATION | The file that you are trying to copy is in use by another process. |
| VFSERR_ALREADYINCOLL | The item is already in the collection. |
| VFSERR_CANTCOPYTOCOLLROOT | Files can not be added to the File Collections root folder. |
| VFSERR_NOMOVETOCOLLECTION | Files can not be moved into a collection. |
| VFSERR_NOJOINTOCOLLECTION | Files can not be joined into a collection. |
| VFSERR_NODROPDATATOCOLLECTION | Data-only files can not be added to a collection. |
| VFSERR_NOCOLLINCOLL | Collections can not be added to other collections. |
| VFSERR_FEATURENOTENABLED | The feature is not enabled. |
| VFSERR_UNKNOWNERROR | An unknown error occurred. |
| VFSERR_CANTCOPYFILEOVERITSELF | You can't copy a file over itself. |
| VFSERR_CANTCHANGEZIPCASE | Limitations of the zip file format mean you can't change the case of a filename within a zip file. |
| VFSERR_NOT_EXTRACTABLE | The file is not extractable. |
Of these errors codes, VFSERR_NOT_SUPPORTED is the most useful to you. You should return this error code whenever your functions do not support some aspect of the API. For example, if you support forwards seeking in files but not random seeking, you should return this error when Opus asks you to seek randomly, and success otherwise.