Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development

acquire the current projects directory ?

(1/1)

metalfan:
Is it possible to acquire the current project's directory (via the plugin) ?
I need it to pass it via the commandline on to a another programm...

stahta01:
http://wiki.codeblocks.org/index.php?title=Variable_expansion

dushara:
See the first 2 messages in this thread: http://forums.codeblocks.org/index.php/topic,13723.msg92491.html#msg92491

I think that's what you want.

metalfan:
I think the thing dushara posted is what i were looking 4, but it doesn't work (it says it isn't defined...)...
This variable_expansion is just a list of predefines, but i need the directory of the currently loaded project when invoking the plugin...

dushara:
This works for me...


--- Code: ---void my_plugin::OnProjectOpen( CodeBlocksEvent& event )
{
    cbProject* prj = event.GetProject();

    if(!prj)
    {
        return;
    }

    const wxString& prj_file = prj->GetFilename();

    ...
}

--- End code ---

Don't forget to register the event handler...


--- Code: ---void my_plugin::OnAttach()
{
    Manager::Get()->RegisterEventSink(cbEVT_PROJECT_OPEN, new cbEventFunctor<my_plugin, CodeBlocksEvent>(this, &my_plugin::OnProjectOpen));
}

--- End code ---

Navigation

[0] Message Index

Go to full version