FolderManager.js

/**
 * @classdesc Provides the APIs for managing folders in CompleteFTP. Instances of this class 
 * should be obtained using {@link Config#folders|Config.folders}.
 *
 * @class
 * @hideconstructor
*/
FolderManager = function () {
	/**
	* Adds a folder of the given type. 
	*
	* @method
	* @param {String} path Absolute path of the folder in the virtual file-system. 
	* @param {String} type Type of the folder. Currently, the following types are supported:
	* * 'VirtualFolder'
	* * 'WindowsFolder'
	* * 'WindowsSpecialFolder'
	* * 'NetworkMacroFolder'
	* @param {String} mappingPath Controls how the folder is mapped to the underlying file-system.  
	* Notes:
	* * This parameter is not required for Virtual folders.
	* * For Windows folders and Network/Macro folders, mappingPaths are Windows file-system paths. In addition,
	* Network/Macro folders' mappingPaths may include macros (listed below) or an 
	* [environment variable](https://en.wikipedia.org/wiki/Environment_variable). 
	* 	* %UserName% - User-name (without domain).
	* 	* %DomainName% - Domain name.
	* 	* %HomeBaseFolder% - Windows path of Home folder (i.e. parent of users' home folders).
	* 	* %ExternalHomeFolder% - [Database users only] Path read from user database.
	* * For Windows special folders, valid values should be:
	* 	* 'Home' (User's home folder)
	* 	* 'Personal' (User's My Documents folders)
	* 	* 'DesktopDirectory' (User's Desktop folder)
	* 	* 'MyPictures' (User's Pictures folder)
	* 	* 'MyMusic' (User's My Music folder)
	* 	
	* @return {Folder} A {@link Folder} object for the added folder. 
	*/
	this.add = function (path, type, mappingPath) { }

	/**
	* Deletes the given folder.
	*
	* @method
	* @param {(String|Folder)} folder Virtual file-system path or {@link Folder} object of the folder to be deleted.
	* @param {Boolean} [recursive=false] If true, the folder will be deleted recursively. 
	*/
	this.remove = function (folder, recursive) { }

	/**
	* Returns a {@link Folder} object for the given path.
	*
	* @method
	* @param {String} path Absolute path of the folder in virtual file-system.
	* @return {Folder}
	*/
	this.get = function (path) { }

	/**
	* Returns an array of {@link Folder} objects representing all root folders in the virtual 
	* file-system including inbuilt ones.
	* 
	* @method
	* @return {Folder[]} 
	*/
	this.list = function () { }

	/**
	* Returns an array of {@link Folder} objects representing all folders in the virtual file-system 
	* regardless of their location in the folder-tree including inbuilt ones.
	* 
	* @method
	* @return {Folder[]}
	*/
	this.listAll = function () { }

	/**
	* Returns a listing of the given Windows folder (in the Windows file-system) in the form of an array 
	* of {@link WindowsFile} objects.
	*
	* @method
	* @param {String} path Absolute path of the folder in the Windows file-system.
	* @param {Boolean} [includeFiles=false] If true, files within the folder are also included.
	* @return {WindowsFile[]} 
	*/
	this.listWindowsDirectory = function (path, includeFiles) { }

	/**
	* Moves the given folder to another path.
	* 
	* @method
	* @param {String|Folder} folder Virtual file-system path or {@link Folder} object of the
	* folder to be moved.
	* @param {String|Folder} parentFolder Virtual file-system path or {@link Folder} object of the folder to move it to. 
	* Note that to move the folder to root level, this parameter needs to be set to '/'.
	*/
	this.move = function (folder, parentFolder) { }
}

/**
 * @classdesc Represents a file or folder in the Windows file-system. 
 * 
 * @class
 * @hideconstructor
 */
WindowsFile = function () {
	/**
	* The name of the file.
	*
	* @type {String}
	* @readonly
	*/
	this.name = null;

	/**
	* The type of the file. It's either 'Directory' or 'File'.
	*
	* @type {String}
	* @readonly
	*/
	this.type = null;

	/**
	* The date and time when the file was last modified.
	*
	* @type {Date}
	* @readonly
	*/
	this.lastWriteTime = null;
}