Modules/FileSystem/translator/copy: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ This function copies a file from a source location to a file at the destination. The contents of the source file are copied, so that source and destination have the same content. Since the transactions happen through kernel-calls, this function is faster than performing the copying yourself through Lua strings. ==Syntax== <syntaxhighlight lang="lua"> bool translator:copy ( string srcPath, string dstPath ) </syntaxhighlight> ==Arguments== *'''srcPath:''' a pat...") |
No edit summary |
||
Line 1: | Line 1: | ||
<pageclass class="#3c82c8" subcaption="Translator function"></pageclass> | |||
__NOTOC__ | __NOTOC__ | ||
This function copies a file from a source location to a file at the destination. The contents of the source file are copied, so that source and destination have the same content. Since the transactions happen through kernel-calls, this function is faster than performing the copying yourself through Lua strings. | This function copies a file from a source location to a file at the destination. The contents of the source file are copied, so that source and destination have the same content. Since the transactions happen through kernel-calls, this function is faster than performing the copying yourself through Lua strings. |
Latest revision as of 03:26, 23 January 2022
This function copies a file from a source location to a file at the destination. The contents of the source file are copied, so that source and destination have the same content. Since the transactions happen through kernel-calls, this function is faster than performing the copying yourself through Lua strings.
Syntax
bool translator:copy ( string srcPath, string dstPath )
Arguments
- srcPath: a path to the source file
- dstPath: the path to the new file that should be copied into
Returns
This function returns true if the file pointed at by srcPath is an accessible file that can be read from and the requested file a dstPath could be created and written to, false otherwise.
Example
Click to collapse [-]
ClientThis snippet backups a copy of client-side configuration for safety purposes.
-- Create a generic translator. local resRoot = fileCreateTranslator( "/" ); resRoot:copy( "config.xml", "backup/config.xml" );