Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CT Input Output Library
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
kulvait
CT Input Output Library
Commits
9781f49a
Commit
9781f49a
authored
Aug 08, 2019
by
kulvait
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIX: absolute path
parent
1515ab9d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
src/rawop.cpp
src/rawop.cpp
+3
-3
tests/rawop.test.cpp
tests/rawop.test.cpp
+6
-0
No files found.
src/rawop.cpp
View file @
9781f49a
...
...
@@ -182,15 +182,15 @@ namespace io {
std
::
string
getParent
(
const
std
::
string
&
path
)
{
std
::
string
absolutePath
=
std
::
experimental
::
filesystem
::
absolute
(
path
);
std
::
string
absolutePath
=
std
::
experimental
::
filesystem
::
absolute
(
path
);
// find last '/' or '\\' symbol in source string
std
::
string
::
size_type
found
=
absolutePath
.
find_last_of
(
"/
\\
"
);
if
(
found
!=
std
::
string
::
npos
)
{
return
path
.
substr
(
0
,
found
);
return
std
::
experimental
::
filesystem
::
canonical
(
absolutePath
.
substr
(
0
,
found
)
);
}
else
{
return
""
;
return
std
::
experimental
::
filesystem
::
canonical
(
"."
)
;
}
}
...
...
tests/rawop.test.cpp
View file @
9781f49a
...
...
@@ -20,3 +20,9 @@ TEST_CASE("TEST: concatenateTextFiles function.", "rawop.h")
std
::
string
content
=
io
::
fileToString
(
outputFile
);
REQUIRE
(
content
==
"A
\n
B
\n
"
);
}
TEST_CASE
(
"TEST: absolute path."
,
"rawop.h"
)
{
std
::
string
p
=
io
::
getParent
(
"abc"
);
//LOGE << p;
}
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