hello,
how can i get name for "IntermediateDirectory" for active project in the plugin?
for example with this i can get project name for active project:
IManager *m_mgr;
wxString projectName = m_mgr->GetWorkspace()->GetActiveProjectName();
But how can i check this for Intermediate Directory, which is setup for example ./Debug
thx.
br, vsfai
how get "IntermediateDirectory" of active project
-
- CodeLite Enthusiast
- Posts: 11
- Joined: Tue Jan 10, 2012 11:50 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: how get "IntermediateDirectory" of active project
To get values of codelite's macros, use the IMacroManager interface.
For example, to get the value of the intermediateDirectory, use this snippet:
Where:
MyProject / Debug are the Project Name / Configuration
You can always take the "long" path and use this approach:
Eran
For example, to get the value of the intermediateDirectory, use this snippet:
Code: Select all
m_mgr->GetMacrosManager()->Expand(wxT("$(IntermediateDirectory)"), m_mgr, wxT("MyProject"), wxT("Debug"));
MyProject / Debug are the Project Name / Configuration
You can always take the "long" path and use this approach:
Code: Select all
wxString confToBuild = wxT("Debug");
wxString project = wxT("MyProject");
// Get the workspace instance
Workspace *workspace = m_mgr->GetWorkspace();
wxString errMsg;
// Locate our project
ProjectPtr proj = workspace->FindProjectByName(project, errMsg);
if(proj) {
// Find the relevant build configuration
BuildConfigPtr bldConf = workspace->GetProjBuildConf(proj->GetName(), confToBuild);
if(bldConf) {
// and finally, we got a complete access to the entire build configuration
// the BuildConfigPtr holds everythign that a user sees in the project settings dialog per project/configuration
// Note that some of the values held in it are not expanded ! (they might contain macros)
// so you will still need to expand them using the macro manager
wxString imdDir = bldConf->GetIntermediateDirectory();
}
}
Make sure you have read the HOW TO POST thread
-
- CodeLite Enthusiast
- Posts: 11
- Joined: Tue Jan 10, 2012 11:50 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
Re: how get "IntermediateDirectory" of active project
Hello,
thank you, the "long" path works very well, thank you for advice.
br, vsfai
thank you, the "long" path works very well, thank you for advice.
br, vsfai
-
- CodeLite Expert
- Posts: 120
- Joined: Sun May 10, 2009 6:56 am
- Contact:
Re: how get "IntermediateDirectory" of active project
You could also write some code to read in the project.mk file and parse the lines themselves. For example, look for "IntermediateDirectory" and skip past whitespaces to reach ":=" and then it's the data after that.
The CL .mk file looks like this (in part):
By simply reading that text file, you can obtain the value as well, inside or outside of CL.
Best regards,
The CL .mk file looks like this (in part):
Code: Select all
##
## Auto Generated makefile by CodeLite IDE
## any manual changes will be erased
##
## WinReleaseUnicode
ProjectName :=LiteEditor
ConfigurationName :=WinReleaseUnicode
IntermediateDirectory :=./Release
OutDir := $(IntermediateDirectory)
WorkspacePath := "/home/rick/source/Codelite"
ProjectPath := "/home/rick/source/Codelite/LiteEditor"
Best regards,