From 456b5dab0f6ac8cce024f2f7e6fefc5464d6d744 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 23 Apr 2008 09:58:18 -0400 Subject: ENH: add better error checks to symlink create stuff --- Source/QtDialog/QMacInstallDialog.cxx | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/Source/QtDialog/QMacInstallDialog.cxx b/Source/QtDialog/QMacInstallDialog.cxx index 70293f8..fbeb10e 100644 --- a/Source/QtDialog/QMacInstallDialog.cxx +++ b/Source/QtDialog/QMacInstallDialog.cxx @@ -69,12 +69,38 @@ void QMacInstallDialog::DoInstall() if(cmSystemTools::FileExists(newName.c_str())) { std::cout << "rm [" << newName << "]\n"; - cmSystemTools::RemoveFile(newName.c_str()); + if(!cmSystemTools::RemoveFile(newName.c_str())) + { + QString message = tr("Failed to remove file " + "installation may be incomplete: "); + message += newName.c_str(); + QString title = tr("Error Removing file"); + QMessageBox::StandardButton btn = + QMessageBox::critical(this, title, message, + QMessageBox::Ok|QMessageBox::Abort); + if(btn == QMessageBox::Abort) + { + return; + } + } } std::cout << "ln -s [" << file << "] ["; std::cout << newName << "]\n"; - cmSystemTools::CreateSymlink(file.c_str(), - newName.c_str()); + if(!cmSystemTools::CreateSymlink(file.c_str(), + newName.c_str())) + { + QString message = tr("Failed create symlink " + "installation may be incomplete: "); + message += newName.c_str(); + QString title = tr("Error Creating Symlink"); + QMessageBox::StandardButton btn = + QMessageBox::critical(this, title, message, + QMessageBox::Ok|QMessageBox::Abort); + if(btn == QMessageBox::Abort) + { + return; + } + } } this->done(0); } -- cgit v0.12