Good day!
In relation to my post previously in:
Quote
http://forums.next.codeblocks.org/index.php/topic,19604.new.html#new
How can i get the file path of my compiled program using my build plugin.
The events already works every time i hit compile button.
thank you for the response.
Checkout the cbProject and CompileTargetBase classes.
Good day!
We had tried some experiments like
-
QuoteManager::Get()->GetProjectManager()->GetActiveProject()->GetFilename()
Returned output:
Quote/file/project/location/file.cbp
(It returns the cbp file)
-
QuoteManager::Get()->GetProjectManager()->GetActiveProject()->GetActiveBuildTarget()
Returned output:
Quotedefault
-
QuoteManager::Get()->GetProjectManager()->GetActiveProject()->GetBasePath()
Returned output:
Quote/file/project/location/
(It returns the project path)
-
QuoteManager::Get()->GetProjectManager()->GetActiveProject()->GetCurrentlyCompilingTarget()->GetFilename()
Returned output: (codeblocks crashes along with codeblocks debug file)
We're trying to get the file path of the compiled file but we have no luck on finding it., :(
Expected:
Quote/file/project/location/file.cpp
[attachment deleted by admin]
What about the CompileTargetBase::GetOutputFilename?
We've tried the
QuoteCompileTargetBase::GetOutputFilename
but it gives the output
Quote/file/project/location
.
Anybody can help? :'(
What object have you used as this project or a target?
We don't really know what you mean but we are creating a plugin. :)
After a lot of trials and errors, we derive on these one:
Quote
wxString activetarget = Manager::Get()->GetProjectManager()->GetActiveProject()->GetActiveBuildTarget();
wxString outputfile = Manager::Get()->GetProjectManager()->GetActiveProject()->GetBuildTarget(activetarget)->GetOutputFilename();
wxString basepath = Manager::Get()->GetProjectManager()->GetActiveProject()->GetBasePath();
wxString executable = basepath + outputfile;
executable.replace(executable.find(_(".")), 4,_(".cpp"));
and we successfully get what we're looking for, getting the
Quote/file/project/location/file.cpp
.
thanks a lot :)
I don't know what project you have loaded, but this is the output for the following script run when the codeblocks-unix.cbp project is open:
> print(GetProjectManager().GetActiveProject().GetBuildTarget(_T("src")).GetOutputFilename())
devel/codeblocks
Have you search the code of C::B to see how GetOutputFilename is used?