Patch #1894 2007-02-23 10:17

pauliusz

Patch for UserTemplate files overwrite bug
Download
1894-Patch_for_User.patch (1.0 KB)
Category
Application::Bugfix
Status
Rejected
Close date
2007-03-27 11:30
Assigned to
 
Index: src/sdk/templatemanager.cpp
===================================================================
--- src/sdk/templatemanager.cpp    (revision 3618)
+++ src/sdk/templatemanager.cpp    (working copy)
@@ -182,6 +182,16 @@
 //        Manager::Get()->GetMessageManager()->DebugLog("dst=%s, dstname=%s", dst.c_str(), dstname.GetFullPath().c_str());
         if (!CreateDirRecursively(dst))
             Manager::Get()->GetMessageManager()->DebugLog(_T("Failed creating directory for %s"), dst.c_str());
+        if (wxFileExists(dst))
+        {
+            if(cbMessageBox(dst + _(" already exists.\nDo you want to replace it?"), _("File exists"), wxICON_EXCLAMATION | wxYES_NO | wxNO_DEFAULT) != wxID_YES)
+            {
+                if (FileTypeOf(dst) == ftCodeBlocksProject)
+                    project_filename = dst;
+                ++count;
+                continue;
+            }
+        }
         if (wxCopyFile(src, dst, true))
         {
             if (FileTypeOf(dst) == ftCodeBlocksProject)
pauliusz 2007-02-23 10:19

This is patch for the following bug I found:

When creating project from UserTemplate on folder where some other project already existed C::B was overwriting files without any warnings...

mandrav 2007-03-27 11:30

Patch doesn't follow the logic of this function. Bug fixed though by patching it differently.