1
1
//////////////////////////////////////////////////////////////////////////////
2
2
//////////////////////////////////////////////////////////////////////////////
4
// copyright : (C) 2008 by Eran Ifrah
5
// file name : exelocator.cpp
4
// copyright : (C) 2008 by Eran Ifrah
5
// file name : exelocator.cpp
7
7
// -------------------------------------------------------------------------
10
// / __ \ | | | | (_) |
11
// | / \/ ___ __| | ___| | _| |_ ___
12
// | | / _ \ / _ |/ _ \ | | | __/ _ )
13
// | \__/\ (_) | (_| | __/ |___| | || __/
14
// \____/\___/ \__,_|\___\_____/_|\__\___|
18
// This program is free software; you can redistribute it and/or modify
19
// it under the terms of the GNU General Public License as published by
20
// the Free Software Foundation; either version 2 of the License, or
21
// (at your option) any later version.
10
// / __ \ | | | | (_) |
11
// | / \/ ___ __| | ___| | _| |_ ___
12
// | | / _ \ / _ |/ _ \ | | | __/ _ )
13
// | \__/\ (_) | (_| | __/ |___| | || __/
14
// \____/\___/ \__,_|\___\_____/_|\__\___|
18
// This program is free software; you can redistribute it and/or modify
19
// it under the terms of the GNU General Public License as published by
20
// the Free Software Foundation; either version 2 of the License, or
21
// (at your option) any later version.
23
23
//////////////////////////////////////////////////////////////////////////////
24
24
//////////////////////////////////////////////////////////////////////////////
25
25
#include "exelocator.h"
26
#include "procutils.h"
26
#include "procutils.h"
28
28
bool ExeLocator::Locate(const wxString &name, wxString &where)
32
// Incase the name is a full path, just test for the file existance
34
if( fn.IsAbsolute() && fn.FileExists() ) {
31
39
wxArrayString output;
32
40
command << wxT("which \"") << name << wxT("\"");
33
41
ProcUtils::SafeExecuteCommand(command, output);
35
43
if(output.IsEmpty() == false){
36
44
wxString interstingLine = output.Item(0);
38
46
if(interstingLine.Trim().Trim(false).IsEmpty()){
42
50
if( !interstingLine.StartsWith(wxT("which: no ")) &&
43
51
!interstingLine.Contains(wxT("command not found")) &&
44
52
!interstingLine.StartsWith(wxT("no "))){