Skip to content
GitLab
Menu
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
d3a9692e
Commit
d3a9692e
authored
Mar 02, 2006
by
Bill Hoffman
Browse files
ENH: check in new find stuff
parent
c1696cf2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Registry.cxx
View file @
d3a9692e
...
...
@@ -267,6 +267,7 @@ bool Registry::DeleteValue(const char *subkey, const char *key)
if
(
!
this
->
Open
(
this
->
GetTopLevel
(),
subkey
,
Registry
::
READWRITE
)
)
{
std
::
cerr
<<
"Failed to open
\n
"
;
return
res
;
}
open
=
true
;
...
...
SystemTools.cxx
View file @
d3a9692e
...
...
@@ -1923,21 +1923,35 @@ kwsys_stl::string SystemTools::FindProgram(
{
return
""
;
}
std
::
string
ext
=
SystemTools
::
GetExecutableExtension
();
if
(
ext
.
size
())
{
unsigned
int
len
=
strlen
(
name
);
if
(
len
>
ext
.
size
())
{
if
(
strcmp
(
name
+
(
len
-
ext
.
size
()),
ext
.
c_str
())
==
0
)
{
ext
=
""
;
// name already has Executable extension
}
}
}
// See if the executable exists as written.
if
(
SystemTools
::
FileExists
(
name
)
&&
!
SystemTools
::
FileIsDirectory
(
name
))
{
return
SystemTools
::
CollapseFullPath
(
name
);
}
kwsys_stl
::
string
tryPath
=
name
;
tryPath
+=
SystemTools
::
GetExecutableExtension
();
if
(
SystemTools
::
FileExists
(
tryPath
.
c_str
())
&&
!
SystemTools
::
FileIsDirectory
(
tryPath
.
c_str
()))
if
(
ext
.
size
())
{
return
SystemTools
::
CollapseFullPath
(
tryPath
.
c_str
());
kwsys_stl
::
string
tryPath
=
name
;
tryPath
+=
ext
;
if
(
SystemTools
::
FileExists
(
tryPath
.
c_str
())
&&
!
SystemTools
::
FileIsDirectory
(
tryPath
.
c_str
()))
{
return
SystemTools
::
CollapseFullPath
(
tryPath
.
c_str
());
}
}
kwsys_stl
::
vector
<
kwsys_stl
::
string
>
path
;
SystemTools
::
GetPath
(
path
,
"CMAKE_PROGRAM_PATH"
);
// Add the system search path to our path.
if
(
!
no_system_path
)
{
...
...
@@ -1954,9 +1968,10 @@ kwsys_stl::string SystemTools::FindProgram(
p
!=
path
.
end
();
++
p
)
{
#ifdef _WIN32
// Remove double quotes from the path on windows
SystemTools
::
ReplaceString
(
*
p
,
"
\"
"
,
""
);
#endif
tryPath
=
*
p
;
kwsys_stl
::
string
tryPath
=
*
p
;
tryPath
+=
"/"
;
tryPath
+=
name
;
if
(
SystemTools
::
FileExists
(
tryPath
.
c_str
())
&&
...
...
@@ -1965,22 +1980,35 @@ kwsys_stl::string SystemTools::FindProgram(
return
SystemTools
::
CollapseFullPath
(
tryPath
.
c_str
());
}
#ifdef _WIN32
tryPath
+=
".com"
;
if
(
SystemTools
::
FileExists
(
tryPath
.
c_str
())
&&
!
SystemTools
::
FileIsDirectory
(
tryPath
.
c_str
()))
// on windows try .com before .exe
if
(
ext
.
size
()
==
0
)
{
return
SystemTools
::
CollapseFullPath
(
tryPath
.
c_str
());
SystemTools
::
ReplaceString
(
tryPath
,
".exe"
,
".com"
);
SystemTools
::
ReplaceString
(
tryPath
,
".EXE"
,
".com"
);
}
else
{
tryPath
+=
".com"
;
}
tryPath
=
*
p
;
tryPath
+=
"/"
;
tryPath
+=
name
;
#endif
tryPath
+=
SystemTools
::
GetExecutableExtension
();
if
(
SystemTools
::
FileExists
(
tryPath
.
c_str
())
&&
!
SystemTools
::
FileIsDirectory
(
tryPath
.
c_str
()))
{
return
SystemTools
::
CollapseFullPath
(
tryPath
.
c_str
());
}
#endif
// now try to add ext if it is different than name
if
(
ext
.
size
())
{
tryPath
=
*
p
;
tryPath
+=
"/"
;
tryPath
+=
name
;
tryPath
+=
ext
;
if
(
SystemTools
::
FileExists
(
tryPath
.
c_str
())
&&
!
SystemTools
::
FileIsDirectory
(
tryPath
.
c_str
()))
{
return
SystemTools
::
CollapseFullPath
(
tryPath
.
c_str
());
}
}
}
// Couldn't find the program.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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