184
edits
(→Browsing contents: forEachFile: details on filter) |
(→General utilities: +overwrite) |
||
| Line 43: | Line 43: | ||
/** | /** | ||
* Copy a file. | |||
* | |||
* Note: OS-accelerated on some platforms. | |||
* | |||
* @param {string} source The name of the file/directory to copy. | * @param {string} source The name of the file/directory to copy. | ||
* @param {string} target The name of the file/directory to be created. | * @param {string} target The name of the file/directory to be created. | ||
* @param {boolean} overwrite If [false] and if the target already exists, fail. | |||
* @throws FileDescriptorError | * @throws FileDescriptorError | ||
*/ | */ | ||
copy: function(source, target) | copy: function(source, target, overwrite) | ||
{ | { | ||
//Unix: need to implement with [open], [read], [write], [close] | //Unix: need to implement with [open], [read], [write], [close] | ||
| Line 55: | Line 60: | ||
/** | /** | ||
* Move a file. | |||
* | |||
* Note: OS-accelerated whenever possible. | |||
* | |||
* @param {string} source The name of the file/directory to move. | * @param {string} source The name of the file/directory to move. | ||
* @param {string} target The name of the file/directory to be created. | * @param {string} target The name of the file/directory to be created. | ||
* @param {boolean} overwrite If [false] and if the target already exists, fail. | |||
* @throws FileDescriptorError | * @throws FileDescriptorError | ||
*/ | */ | ||
move: function(source, target) | move: function(source, target, overwrite) | ||
{ | { | ||
//Unix: maps to [rename] or, when [rename] returns EXDEV, on [FileUtilities.copy]+[FileUtilities.remove] | //Unix: maps to [rename] or, when [rename] returns EXDEV, on [FileUtilities.copy]+[FileUtilities.remove] | ||
//Windows: maps to [MoveFile] http://msdn.microsoft.com/en-us/library/aa365239(v=VS.85).aspx | //Windows: maps to [MoveFile] http://msdn.microsoft.com/en-us/library/aa365239(v=VS.85).aspx | ||
//Check if it works with directories | |||
}, | }, | ||
edits