I'd like to make a tool that could get me into my project folder quick. I can know how to get into a folder, I just have to type.. explorer ${PROJECT_DIR} as the command line. Problem is my projects look like this
Project Folder
/src
/obj
/folders with data files
Project.exe
So my project folder command brings me into Project Folder/src. Is there any way I can just navigate to just Project Folder?
cbProject::GetCommonTopLevelPath()
what should ${PROJECT_DIR} return, the dir where the cbp file is located ??
or is ${PROJECT_DIR} not a variable.
Do I understand it is something you would register in the tools menu ??
Or are you writing code, then you can use Thomas' solution.
There is no other solution since the common toplevel path is not available as a variable, and a script would not know about the project structure...
But luckily, it is really easy. Make a plugin of type "Tool" and fill in something like this:
virtual int Execute()
{
wxString x(_T("explorer ") + Manager::Get()->GetProjectManager()->GetActiveProject()->GetCommonTopLevelPath());
::wxExecute(x);
};
Compile and run, should do what you want.
EDIT: missing brace
explorer ${PROJECT_DIR}..
?
Works for me.
EDIT: Accidentally threw an unneeded slash in there.
Well yes, this works for exactly one layout, but not for arbitrary layouts...
And takes marginally less time to implement. Plus, if all the files C::B ever sees are in the src subdirectory, that's what GetCommonTopLevelPath() will return, ne?
Quote from: TDragon on March 10, 2006, 12:03:39 AM
And takes marginally less time to implement. Plus, if all the files C::B ever sees are in the src subdirectory, that's what GetCommonTopLevelPath() will return, ne?
It will return what it says: the common top-level path for the
project.
Example:
devel
myproject_dir (<-- this will be returned by cbProject::GetCommonTopLevelPath())
include
a_file.h
src
a_file.cpp
b_file.cpp
projects
codeblocks
myproject.cbp (<-- this is your project file)
visualXXX
myproject.vcproj
And since it's trivial to be added as a macro, I think we will.
Quote from: SVN commit log
Added $PROJECT_TOPDIR macro. Aliases: $PROJECT_TOPDIRECTORY, $PROJECTTOPDIR and $PROJECTTOPDIRECTORY. Returns the project's common top-level path.
Oops, sorry for the confusion, I should have been more specific in my original post. Anyways, you got the idea after a few posts. :lol: I figured there would be some kind of directory relative path code to make it work, like ./ .. ..\ or something like that.. I never learned those codes.
That new addition will be very helpful eventually, when a new release is made.