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
VTK
VTK
Commits
35cf51fa
Commit
35cf51fa
authored
Oct 02, 2007
by
Bill Hoffman
Browse files
ENH: speed up actual path name by cache on windows
parent
a0542af8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Utilities/kwsys/SystemTools.cxx
View file @
35cf51fa
...
...
@@ -1464,7 +1464,8 @@ kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const char* path)
// make it big enough for all of path and double quotes
ret
.
reserve
(
strlen
(
path
)
+
3
);
// put path into the string
ret
.
insert
(
0
,
path
);
ret
.
assign
(
path
);
ret
=
path
;
kwsys_stl
::
string
::
size_type
pos
=
0
;
// first convert all of the slashes
while
((
pos
=
ret
.
find
(
'/'
,
pos
))
!=
kwsys_stl
::
string
::
npos
)
...
...
@@ -2879,6 +2880,14 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const char* p)
#ifndef _WIN32
return
p
;
#else
// Check to see if actual case has already been called
// for this path, and the result is stored in the LongPathMap
SystemToolsTranslationMap
::
iterator
i
=
SystemTools
::
LongPathMap
->
find
(
p
);
if
(
i
!=
SystemTools
::
LongPathMap
->
end
())
{
return
i
->
second
;
}
kwsys_stl
::
string
shortPath
;
if
(
!
SystemTools
::
GetShortPath
(
p
,
shortPath
))
{
...
...
@@ -2895,6 +2904,7 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const char* p)
{
longPath
[
0
]
=
toupper
(
longPath
[
0
]);
}
(
*
SystemTools
::
LongPathMap
)[
p
]
=
longPath
;
return
longPath
;
#endif
}
...
...
@@ -4192,6 +4202,7 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
// necessary.
unsigned
int
SystemToolsManagerCount
;
SystemToolsTranslationMap
*
SystemTools
::
TranslationMap
;
SystemToolsTranslationMap
*
SystemTools
::
LongPathMap
;
// SystemToolsManager manages the SystemTools singleton.
// SystemToolsManager should be included in any translation unit
...
...
@@ -4219,6 +4230,7 @@ void SystemTools::ClassInitialize()
{
// Allocate the translation map first.
SystemTools
::
TranslationMap
=
new
SystemToolsTranslationMap
;
SystemTools
::
LongPathMap
=
new
SystemToolsTranslationMap
;
// Add some special translation paths for unix. These are not added
// for windows because drive letters need to be maintained. Also,
...
...
@@ -4274,6 +4286,7 @@ void SystemTools::ClassInitialize()
void
SystemTools
::
ClassFinalize
()
{
delete
SystemTools
::
TranslationMap
;
delete
SystemTools
::
LongPathMap
;
}
...
...
Utilities/kwsys/SystemTools.hxx.in
View file @
35cf51fa
...
...
@@ -813,6 +813,7 @@ private:
* Each time 'dir' will be found it will be replace by 'refdir'
*/
static SystemToolsTranslationMap *TranslationMap;
static SystemToolsTranslationMap *LongPathMap;
friend class SystemToolsManager;
};
...
...
Write
Preview
Supports
Markdown
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