Added code to throw an error if the plugin can't be deleted or written to #4696

This commit is contained in:
Adam Potolsky 2015-06-11 17:40:26 -07:00
parent 6bb44fbc59
commit 5696497bc0
1 changed files with 11 additions and 2 deletions

View File

@ -115,7 +115,14 @@ void PluginManager::copyPlugins()
QFile newFile(newName); QFile newFile(newName);
if(newFile.exists()) { if(newFile.exists()) {
// If it does, delete it. TODO: Check to see if same and leave // If it does, delete it. TODO: Check to see if same and leave
newFile.remove(); bool result = newFile.remove();
if( !result ) {
emit error(
tr( "Unable to delete plugin:\n%1\n"
"Please stop synergy and run the wizard again.")
.arg(newName));
return;
}
} }
// make a copy of the plugin in the new location // make a copy of the plugin in the new location
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
@ -125,10 +132,12 @@ void PluginManager::copyPlugins()
#endif #endif
if ( !result ) { if ( !result ) {
emit error( emit error(
tr("Failed to copy plugin '%1' to: %2\n%3") tr("Failed to copy plugin '%1' to: %2\n%3\n"
"Please stop synergy and run the wizard again.")
.arg(m_FileSysPluginList.at(i)) .arg(m_FileSysPluginList.at(i))
.arg(newName) .arg(newName)
.arg(file.errorString())); .arg(file.errorString()));
return;
} }
else { else {
emit info( emit info(