Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: bugmenot on January 29, 2007, 02:24:59 pm

Title: Codeblocks doesn't save project
Post by: bugmenot 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?
Title: Re: Codeblocks doesn't save project
Post by: Biplab on January 29, 2007, 02:40:11 pm
I confirm this. It's screwing up new projects.  :(
Title: Re: Codeblocks doesn't save project
Post by: tiwag 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.
Title: Re: Codeblocks doesn't save project
Post by: Biplab on January 29, 2007, 05:54:09 pm
Even R3545 worked fine for me. After upgrading to R3547 the problem started.
Title: Re: Codeblocks doesn't save project
Post by: mandrav on January 29, 2007, 06:43:08 pm
r3547 seems to cause the problem. Thomas, can you double check your changes in r3547?
Title: Re: Codeblocks doesn't save project
Post by: killerbot 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();
}
Title: Re: Codeblocks doesn't save project
Post by: killerbot 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.
Title: Re: Codeblocks doesn't save project
Post by: killerbot 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 ...
Title: Re: Codeblocks doesn't save project
Post by: killerbot 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
Title: Re: Codeblocks doesn't save project
Post by: bugmenot on January 30, 2007, 03:34:53 pm
thanks guys :)