Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
3005672d
Commit
3005672d
authored
Oct 27, 2020
by
vslashg
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3044 from manavrion:improve_file_path_normalize
PiperOrigin-RevId: 339242159
parents
1845b85a
113ca75c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
gtest-filepath.cc
googletest/src/gtest-filepath.cc
+5
-7
No files found.
googletest/src/gtest-filepath.cc
View file @
3005672d
...
...
@@ -349,21 +349,19 @@ FilePath FilePath::RemoveTrailingPathSeparator() const {
// For example, "bar///foo" becomes "bar/foo". Does not eliminate other
// redundancies that might be in a pathname involving "." or "..".
void
FilePath
::
Normalize
()
{
std
::
string
normalized_pathname
;
normalized_pathname
.
reserve
(
pathname_
.
length
());
auto
out
=
pathname_
.
begin
();
for
(
const
char
character
:
pathname_
)
{
if
(
!
IsPathSeparator
(
character
))
{
normalized_pathname
.
push_back
(
character
);
}
else
if
(
normalized_pathname
.
empty
()
||
normalized_pathname
.
back
()
!=
kPathSeparator
)
{
normalized_pathname
.
push_back
(
kPathSeparator
);
*
(
out
++
)
=
character
;
}
else
if
(
out
==
pathname_
.
begin
()
||
*
std
::
prev
(
out
)
!=
kPathSeparator
)
{
*
(
out
++
)
=
kPathSeparator
;
}
else
{
continue
;
}
}
pathname_
=
normalized_pathname
;
pathname_
.
erase
(
out
,
pathname_
.
end
())
;
}
}
// namespace internal
...
...
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