Author Topic: Codeblocks doesn't save project  (Read 6911 times)

Offline bugmenot

  • Multiple posting newcomer
  • *
  • Posts: 32
Codeblocks doesn't save project
« on: January 29, 2007, 02:24:59 pm »
Hi,

I use Codeblocks SVN 3547.

If I create a project, close Codeblocks and try to reopen it, all options are gone and all project files too.
The project is also renamed as "". I tried every save option, changed file permissions (linux) to rw for everyone...

Code
</Build>
                <Compiler>
                        <Add />
                        <Add />
                </Compiler>
                <Linker>
                        <Add />
                </Linker>
                <Unit />
                <Unit />

It seems that codeblocks doesn't write the cbp file properly,

Can you help me please?

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Codeblocks doesn't save project
« Reply #1 on: January 29, 2007, 02:40:11 pm »
I confirm this. It's screwing up new projects.  :(
Be a part of the solution, not a part of the problem.

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Codeblocks doesn't save project
« Reply #2 on: January 29, 2007, 05:39:03 pm »
confirm that bug too (CB rev 3547),
my last backup (CB rev 3540) saves the projects well.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Codeblocks doesn't save project
« Reply #3 on: January 29, 2007, 05:54:09 pm »
Even R3545 worked fine for me. After upgrading to R3547 the problem started.
Be a part of the solution, not a part of the problem.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Codeblocks doesn't save project
« Reply #4 on: January 29, 2007, 06:43:08 pm »
r3547 seems to cause the problem. Thomas, can you double check your changes in r3547?
Be patient!
This bug will be fixed soon...

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5516
Re: Codeblocks doesn't save project
« Reply #5 on: January 29, 2007, 08:20:04 pm »
looking at the changes, the 0 arguments are lo longer passed, and have no a default value in the function.

But the problem is :
But where in the past attributes would have been added, now they are only added to a local variable, which is not used afterwards. So that's an error for sure !!! And this is the cause !!!

Code
TiXmlElement* ProjectLoader::AddElement(TiXmlElement* parent, const char* name, const char* attr, const wxString& attribute)
{
    TiXmlElement elem(name);

    if (attr)
        elem.SetAttribute(attr, cbU2C(attribute));

    //return parent->InsertEndChild(TiXmlElement(name))->ToElement();
    return static_cast<TiXmlElement*>(parent->InsertEndChild(TiXmlElement(name)));
}

This should be :

Code
TiXmlElement* ProjectLoader::AddElement(TiXmlElement* parent, const char* name, const char* attr, const wxString& attribute)
{
    TiXmlElement elem(name);

    if (attr)
        elem.SetAttribute(attr, cbU2C(attribute));

   /return parent->InsertEndChild(elem)->ToElement();
}


and
Code
TiXmlElement* ProjectLoader::AddElement(TiXmlElement* parent, const char* name, const char* attr, int attribute)
{
    TiXmlElement elem(name);

    if (attr)
        elem.SetAttribute(attr, attribute);

    //return parent->InsertEndChild(TiXmlElement(name))->ToElement();
    return static_cast<TiXmlElement*>(parent->InsertEndChild(TiXmlElement(name)));
}

should be changed into :

Code
TiXmlElement* ProjectLoader::AddElement(TiXmlElement* parent, const char* name, const char* attr, int attribute)
{
    TiXmlElement elem(name);

    if (attr)
        elem.SetAttribute(attr, attribute);

    return parent->InsertEndChild(elem)->ToElement();
}
« Last Edit: January 29, 2007, 08:26:40 pm by killerbot »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5516
Re: Codeblocks doesn't save project
« Reply #6 on: January 29, 2007, 08:29:52 pm »
@Thomas, I will commit this, in case you anted i different , feel free to change it ;-)
Done, and it works again.
« Last Edit: January 29, 2007, 08:47:25 pm by killerbot »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5516
Re: Codeblocks doesn't save project
« Reply #7 on: January 29, 2007, 09:56:34 pm »
I have the feeling not all problems are gone yet. I create a new project (tried it out on linux), project is saved (looks ok), but can't be loaded afterwards ... :-(

EDIT :
this is the project file (created new console project) :
Code
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="DeleteMeTest" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="./DeleteMeTest" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="./DeleteMeTest" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Unit filename="main.cpp" />
<Extensions ="">
<code_completion />
</Extensions>
</Project>
</CodeBlocks_project_file>
I compared it with another project file (similar project), it looks the same (only the project name is different and as such output filename) : but CB refuses to open it, says it can't and if i want to remove it from the recent list. Properties in linux claims there are 86 words, and my other older project (that still opens ok) has 85 words. I just don't see it ...
« Last Edit: January 29, 2007, 10:50:49 pm by killerbot »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5516
Re: Codeblocks doesn't save project
« Reply #8 on: January 29, 2007, 10:53:28 pm »
aha found it :
Code
<Extensions ="">

should be :
Code
<Extensions>

this is probably due to all those 'default' arguments !!!

EDIT :
fixed and committed
« Last Edit: January 29, 2007, 10:58:19 pm by killerbot »

Offline bugmenot

  • Multiple posting newcomer
  • *
  • Posts: 32
Re: Codeblocks doesn't save project
« Reply #9 on: January 30, 2007, 03:34:53 pm »
thanks guys :)