I think I found a bug in the scripted wizard plugin. But I am quite new to this part of C::B. So here is what I found:
Before a file gets generated within GenerateFile(), the check if the file does exist is done in the directory of the project which was active when the wizard was started. So it complains that a file already exists but is is in a different project. (It even askes if it can overwrite the file.)
Is there a reason to not move the check to the point where the full path is constructed?
Index: wiz.cpp
===================================================================
--- wiz.cpp (revision 7713)
+++ wiz.cpp (working copy)
@@ -667,22 +667,6 @@
{
wxFileName fname(filename);
- if ( fname.FileExists() )
- {
- wxString query_overwrite;
- query_overwrite.Printf(
- _T("Warning:\n")
- _T("The wizard is about OVERWRITE the following existing file:\n")+
- fname.GetFullPath()+_T("\n\n")+
- _T("Are you sure that you want to OVERWRITE the file?\n\n")+
- _T("(If you answer 'No' the existing file will be kept.)"));
- if (cbMessageBox(query_overwrite, _T("Confirmation"),
- wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT) == wxID_NO)
- {
- return fname.GetFullPath();
- }
- }
-
// extension sanity check
FileType ft = FileTypeOf(fname.GetFullPath());
switch (ft)
@@ -731,6 +715,21 @@
}
fname = basePath + wxFILE_SEP_PATH + fname.GetFullPath();
+ if ( fname.FileExists() )
+ {
+ wxString query_overwrite;
+ query_overwrite.Printf(
+ _T("Warning:\n")
+ _T("The wizard is about OVERWRITE the following existing file:\n")+
+ fname.GetFullPath()+_T("\n\n") +
+ _T("Are you sure that you want to OVERWRITE the file?\n\n")+
+ _T("(If you answer 'No' the existing file will be kept.)"));
+ if (cbMessageBox(query_overwrite, _T("Confirmation"),
+ wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT) == wxID_NO)
+ {
+ return fname.GetFullPath();
+ }
+ }
// create the file with the passed contents
wxFileName::Mkdir(fname.GetPath(),0777,wxPATH_MKDIR_FULL);