Author Topic: Get full path to executable in script  (Read 3408 times)

Offline Lazybones

  • Multiple posting newcomer
  • *
  • Posts: 14
Get full path to executable in script
« on: February 06, 2007, 02:33:04 pm »
Hi there!

I want to create my own script plugin, which calls an external tool via a menu entry. With the sample plugin script, this works fine.

Now my problem: the external tool needs the name of the executable including its full path. I have tried some of the documented methods of the active projects but none of them returns the correct path. Some only return the name of the executable, some only a path (which did not contain my executable...).

Can anyone help me with my problem?

Thank you

Sven

Code
local executable = GetProjectManager().GetActiveProject().GetOutputFilename();

if (!IsNull(executable))
{
   ::ShowMessage(outputfile);
   IO.Execute(_T("insight ") + executable);
}

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7600
    • My Best Post
Re: Get full path to executable in script
« Reply #1 on: February 06, 2007, 02:39:42 pm »
Have you looked at wxFileName::GetFullPath, note I have no idea if it does what you want but it looks like it should.

Tim S
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Get full path to executable in script
« Reply #2 on: February 06, 2007, 02:41:12 pm »
Hint: a project doesn't actually produce any output on its own. Build targets do. Check GetActiveProject().GetActiveBuildTarget()...
Be patient!
This bug will be fixed soon...

Offline Lazybones

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Get full path to executable in script
« Reply #3 on: February 07, 2007, 06:47:06 pm »
Hello all,

thank you for your replies, I solved my problem with this code:

Code
local activetarget = GetProjectManager().GetActiveProject().GetActiveBuildTarget();
if (!IsNull(activetarget))
{
  local outputfile = GetProjectManager().GetActiveProject().GetBuildTarget(activetarget).GetOutputFilename();
  local basepath = GetProjectManager().GetActiveProject().GetBasePath();
  local executable = basepath  + outputfile;
}