Originally Posted by axysharma
Thanx..it is working that way. But if the file is already at the location where I am trying to save, it overwrites it without prompting any message. is there any way we can handle it. i mean if file is already there, then it should prompt message to overwrite it.
sure - you'd use something like:
nsDialogs::SelectFileDialog save "$DOCUMENTS\hello_world.txt" "*.txt"
StrCmp "$0" "" _skip
MessageBox MB_OK "Save location: [$0]"
IfFileExists "$0" 0 _copyFile
MessageBox MB_YESNO "The file '$0' already exists. Do you wish to overwrite?" /SD IDNO IDNO _getSavePath
CopyFiles /SILENT "$PLUGINSDIR\hello_world.txt" "$0"
This checks if the path was empty (user canceled), in which case all the code is skipped.
This checks if the path already exists, in which case the installers asks the user if they want to overwrite, first. If they do not want to overwrite (the default), the user is prompted for a new path by going back to the beginning of the code.
If the path does not already exist, or the user chooses to overwrite, it will continue with the CopyFiles code as before.