Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Roger Leigh
KWSys
Commits
a3caaeec
Commit
a3caaeec
authored
Mar 05, 2018
by
Ben Boeckel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SystemTools: faster relative path codepath
parent
2ad561e7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
SystemTools.cxx
SystemTools.cxx
+10
-5
No files found.
SystemTools.cxx
View file @
a3caaeec
...
...
@@ -3344,15 +3344,20 @@ std::string SystemTools::RelativePath(const std::string& local,
static
std
::
string
GetCasePathName
(
std
::
string
const
&
pathIn
)
{
std
::
string
casePath
;
std
::
vector
<
std
::
string
>
path_components
;
SystemTools
::
SplitPath
(
pathIn
,
path_components
);
if
(
path_components
[
0
].
empty
())
// First component always exists.
{
// Relative paths cannot be converted.
// First check if the file is relative. We don't fix relative paths since the
// real case depends on the root directory and the given path fragment may
// have meaning elsewhere in the project.
if
(
!
SystemTools
::
FileIsFullPath
(
pathIn
))
{
// This looks unnecessary, but it allows for the return value optimization
// since all return paths return the same local variable.
casePath
=
pathIn
;
return
casePath
;
}
std
::
vector
<
std
::
string
>
path_components
;
SystemTools
::
SplitPath
(
pathIn
,
path_components
);
// Start with root component.
std
::
vector
<
std
::
string
>::
size_type
idx
=
0
;
casePath
=
path_components
[
idx
++
];
...
...
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