Close any set-aside connection
| 575 | |
| 576 | // Close any set-aside connection |
| 577 | void ProjectFileIO::DiscardConnection() |
| 578 | { |
| 579 | if (mPrevConn) |
| 580 | { |
| 581 | if (!mPrevConn->Close()) |
| 582 | { |
| 583 | // Store an error message |
| 584 | SetDBError( |
| 585 | XO("Failed to discard connection") |
| 586 | ); |
| 587 | } |
| 588 | |
| 589 | // If this is a temporary project, we no longer want to keep the |
| 590 | // project file. |
| 591 | if (mPrevTemporary) |
| 592 | { |
| 593 | // This is just a safety check. |
| 594 | wxFileName temp(TempDirectory::TempDir(), wxT("")); |
| 595 | wxFileName file(mPrevFileName); |
| 596 | file.SetFullName(wxT("")); |
| 597 | if (file == temp) |
| 598 | { |
| 599 | if (!RemoveProject(mPrevFileName)) |
| 600 | { |
| 601 | wxLogMessage("Failed to remove temporary project %s", mPrevFileName); |
| 602 | } |
| 603 | } |
| 604 | } |
| 605 | mPrevConn = nullptr; |
| 606 | mPrevFileName.clear(); |
| 607 | } |
| 608 | } |
| 609 | |
| 610 | // Close any current connection and switch back to using the saved |
| 611 | void ProjectFileIO::RestoreConnection() |