GetCurrentVFS()

// in class: Session
function GetCurrentVFS(): VFS;

This function returns a pointer to an object that represents the current Virtual File System (VFS), if any, for the current session.

Warning

The returned pointer may be null when the client session has started but no VFS has been selected yet, so this condition must be checked before using the returned object.

Example

{
  var vfs = Session.GetCurrentVFS();
  if (vfs !== null) {
    // we have a valid VFS object, so we can use it here...
  }
}

Certain event-handlers can only be triggered by conditions that can never happen without an active/selected VFS. Think about AfterFileUpload for example: it runs a script after a file has been uploaded, and no upload can ever occur unless a VFS has already been selected during a file-transfer session. So, when the script is run by one of these event-handlers, the developer may skip the null-check.