~ubuntu-branches/ubuntu/karmic/codelite/karmic

« back to all changes in this revision

Viewing changes to Plugin/exelocator.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2009-08-15 17:42:43 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20090815174243-nlb9ikgigbiybz12
Tags: 1.0.2893+dfsg-0ubuntu1
* debian/rules:
  + Tidy up get-orig-source rule
* debian/control:
  + Bump Standards-Version
  + Change Maintainer email address to @ubuntu.com
  + Drop cdbs build-dependency
* debian/copyright:
  + Update to DEP-5 format
* debian/patches/00_add-fPIC.patch:
  + Dropped, fix upstream
* Closes LP: #413992

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//////////////////////////////////////////////////////////////////////////////
2
2
//////////////////////////////////////////////////////////////////////////////
3
3
//
4
 
// copyright            : (C) 2008 by Eran Ifrah                            
5
 
// file name            : exelocator.cpp              
6
 
//                                                                          
 
4
// copyright            : (C) 2008 by Eran Ifrah
 
5
// file name            : exelocator.cpp
 
6
//
7
7
// -------------------------------------------------------------------------
8
 
// A                                                                        
9
 
//              _____           _      _     _ _                            
10
 
//             /  __ \         | |    | |   (_) |                           
11
 
//             | /  \/ ___   __| | ___| |    _| |_ ___                      
12
 
//             | |    / _ \ / _  |/ _ \ |   | | __/ _ )                     
13
 
//             | \__/\ (_) | (_| |  __/ |___| | ||  __/                     
14
 
//              \____/\___/ \__,_|\___\_____/_|\__\___|                     
15
 
//                                                                          
16
 
//                                                  F i l e                 
17
 
//                                                                          
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.                                   
22
 
//                                                                          
 
8
// A
 
9
//              _____           _      _     _ _
 
10
//             /  __ \         | |    | |   (_) |
 
11
//             | /  \/ ___   __| | ___| |    _| |_ ___
 
12
//             | |    / _ \ / _  |/ _ \ |   | | __/ _ )
 
13
//             | \__/\ (_) | (_| |  __/ |___| | ||  __/
 
14
//              \____/\___/ \__,_|\___\_____/_|\__\___|
 
15
//
 
16
//                                                  F i l e
 
17
//
 
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.
 
22
//
23
23
//////////////////////////////////////////////////////////////////////////////
24
24
//////////////////////////////////////////////////////////////////////////////
25
25
 #include "exelocator.h"
26
 
#include "procutils.h" 
 
26
#include "procutils.h"
27
27
 
28
28
bool ExeLocator::Locate(const wxString &name, wxString &where)
29
29
{
30
30
        wxString command;
 
31
 
 
32
        // Incase the name is a full path, just test for the file existance
 
33
        wxFileName fn(name);
 
34
        if( fn.IsAbsolute() && fn.FileExists() ) {
 
35
                where = name;
 
36
                return true;
 
37
        }
 
38
 
31
39
        wxArrayString output;
32
40
        command << wxT("which \"") << name << wxT("\"");
33
41
        ProcUtils::SafeExecuteCommand(command, output);
34
 
        
 
42
 
35
43
        if(output.IsEmpty() == false){
36
44
                wxString interstingLine = output.Item(0);
37
 
                
 
45
 
38
46
                if(interstingLine.Trim().Trim(false).IsEmpty()){
39
47
                        return false;
40
48
                }
41
 
                
 
49
 
42
50
                if(     !interstingLine.StartsWith(wxT("which: no ")) &&
43
51
                        !interstingLine.Contains(wxT("command not found")) &&
44
52
                        !interstingLine.StartsWith(wxT("no "))){