copyFileWithPrompt

Supported from HBuilderX 2.9.12+

Copy the specified file or folder to the target folder

Parameter

Name Type Description
options CopyFileWithPromptOptions File copy parameters

Returns

Type Description
Promise<String> Result (failed or successful or cancelled)

Returns:

code Description
-1 Failed
0 Successful
1 Operation cancelled

Example

  1. let result = hx.workspace.copyFileWithPrompt({
  2. src:hx.Uri.file('D:/test01'),
  3. dest:hx.Uri.file('E:/test01'),
  4. rootPromptTips:'Target file already exists',
  5. filePromptTips:'Target file already exists',
  6. filter:function(params){
  7. console.log(params)
  8. return 0;
  9. },
  10. errorHandler:function(err){
  11. console.log(err)
  12. return 0;
  13. }
  14. });
  15. result.then((data)=>{
  16. });

CopyFileWithPromptOptions

File copy configuration

Attribute list

Attribute name Type Description
src Uri The source address of the copied file, the address is an absolute path
dest Uri The destination address of the copied file, the address is an absolute path and a directory
rootPromptTips String Root directory prompt
filePromptTips String Target file prompt
filter Function(Uri) Callback uri
errorHandler Function(Uri) Error callback handler, 0: cancel, 1: retry, 2: skip