Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Bug in AddMultipleFilesToProject
(1/1)
BlueHazzard:
--- Code: ---int ProjectManager::AddMultipleFilesToProject(const wxArrayString& filelist, cbProject* project, int target)
{
if (!project)
project = GetActiveProject();
wxArrayInt targets;
targets.Add(target);
if (AddMultipleFilesToProject(filelist, project, targets) == 1)
return targets[0];
return -1;
}
--- End code ---
The documentation says, that in this function, if the parameter target == -1 then the user gets asked for the targets to add...
Now, AddMultipleFilesToProject calls DoAddFiles
--- Code: ---nt ProjectManager::DoAddFileToProject(const wxString& filename, cbProject* project, wxArrayInt& targets)
{
if (!project)
return 0;
if (!SetupTargets(targets, project, m_ui))
return 0;
--- End code ---
And do add files calls setupTargets
Setup targets checks if the targets array is empty and if so, asks the user for the targets...
In our case the array is not empty, but filled with -1 so the documentation is wrong
--- Code: ---bool SetupTargets(wxArrayInt &targets, cbProject *project, cbProjectManagerUI *ui)
{
cbAssert(project);
cbAssert(ui);
// do we have to ask for target?
if (targets.GetCount() == 0)
{
--- End code ---
Or am i missing something?
Miguel Gimenez:
IMHO you are right, this
--- Code: --- targets.Add(target);
--- End code ---
should be changed to
--- Code: --- if (target != -1)
targets.Add(target);
--- End code ---
BlueHazzard:
fixed in trunk
Navigation
[0] Message Index
Go to full version