Author Topic: Tools Help  (Read 6513 times)

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Tools Help
« on: March 09, 2006, 11:29:22 pm »
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?
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Tools Help
« Reply #1 on: March 09, 2006, 11:39:02 pm »
cbProject::GetCommonTopLevelPath()
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: Tools Help
« Reply #2 on: March 09, 2006, 11:39:27 pm »
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.
« Last Edit: March 09, 2006, 11:41:03 pm by killerbot »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Tools Help
« Reply #3 on: March 09, 2006, 11:52:55 pm »
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:
Code
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
« Last Edit: March 09, 2006, 11:55:15 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Tools Help
« Reply #4 on: March 09, 2006, 11:55:48 pm »
explorer ${PROJECT_DIR}..
?

Works for me.

EDIT: Accidentally threw an unneeded slash in there.
« Last Edit: March 10, 2006, 12:10:19 am by TDragon »
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Tools Help
« Reply #5 on: March 09, 2006, 11:57:59 pm »
Well yes, this works for exactly one layout, but not for arbitrary layouts...
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Tools Help
« Reply #6 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?
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Tools Help
« Reply #7 on: March 10, 2006, 08:25:54 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.
Be patient!
This bug will be fixed soon...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Tools Help
« Reply #8 on: March 10, 2006, 09:25:54 am »
Quote from: SVN commit log
Added $PROJECT_TOPDIR macro. Aliases: $PROJECT_TOPDIRECTORY, $PROJECTTOPDIR and $PROJECTTOPDIRECTORY. Returns the project's common top-level path.
Be patient!
This bug will be fixed soon...

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: Tools Help
« Reply #9 on: March 11, 2006, 08:10:50 am »
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.
« Last Edit: March 11, 2006, 08:37:13 am by Vampyre_Dark »
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~