Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Chuck Atkins
KWSys
Commits
28d17e64
Commit
28d17e64
authored
May 08, 2006
by
Bill Hoffman
Browse files
ENH: search for program without extensions
parent
55bb42d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
SystemTools.cxx
View file @
28d17e64
...
...
@@ -2018,7 +2018,7 @@ kwsys_stl::string SystemTools::FindProgram(
}
kwsys_stl
::
string
name
=
nameIn
;
kwsys_stl
::
vector
<
kwsys_stl
::
string
>
extensions
;
#if defined (_WIN32) || defined(__CYGWIN__) | defined(__MINGW32__)
#if defined (_WIN32) || defined(__CYGWIN__) |
|
defined(__MINGW32__)
bool
hasExtension
=
false
;
// check to see if the name already has a .xxx at
// the end of it
...
...
@@ -2034,8 +2034,8 @@ kwsys_stl::string SystemTools::FindProgram(
}
#endif
kwsys_stl
::
string
tryPath
;
// first try the name as it was given (adding extensions
//
if needed.)
//
first try with extensions if the os supports them
if
(
extensions
.
size
())
{
for
(
kwsys_stl
::
vector
<
kwsys_stl
::
string
>::
iterator
i
=
...
...
@@ -2050,14 +2050,12 @@ kwsys_stl::string SystemTools::FindProgram(
}
}
}
else
// now try just the name
tryPath
=
name
;
if
(
SystemTools
::
FileExists
(
tryPath
.
c_str
())
&&
!
SystemTools
::
FileIsDirectory
(
tryPath
.
c_str
()))
{
tryPath
=
name
;
if
(
SystemTools
::
FileExists
(
tryPath
.
c_str
())
&&
!
SystemTools
::
FileIsDirectory
(
tryPath
.
c_str
()))
{
return
SystemTools
::
CollapseFullPath
(
tryPath
.
c_str
());
}
return
SystemTools
::
CollapseFullPath
(
tryPath
.
c_str
());
}
// now construct the path
kwsys_stl
::
vector
<
kwsys_stl
::
string
>
path
;
...
...
@@ -2080,6 +2078,7 @@ kwsys_stl::string SystemTools::FindProgram(
// Remove double quotes from the path on windows
SystemTools
::
ReplaceString
(
*
p
,
"
\"
"
,
""
);
#endif
// first try with extensions
if
(
extensions
.
size
())
{
for
(
kwsys_stl
::
vector
<
kwsys_stl
::
string
>::
iterator
ext
...
...
@@ -2096,16 +2095,14 @@ kwsys_stl::string SystemTools::FindProgram(
}
}
}
else
// now try it without them
tryPath
=
*
p
;
tryPath
+=
"/"
;
tryPath
+=
name
;
if
(
SystemTools
::
FileExists
(
tryPath
.
c_str
())
&&
!
SystemTools
::
FileIsDirectory
(
tryPath
.
c_str
()))
{
tryPath
=
*
p
;
tryPath
+=
"/"
;
tryPath
+=
name
;
if
(
SystemTools
::
FileExists
(
tryPath
.
c_str
())
&&
!
SystemTools
::
FileIsDirectory
(
tryPath
.
c_str
()))
{
return
SystemTools
::
CollapseFullPath
(
tryPath
.
c_str
());
}
return
SystemTools
::
CollapseFullPath
(
tryPath
.
c_str
());
}
}
// Couldn't find the program.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment