[niepce] fwk: remove fwk::path_stem()
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce] fwk: remove fwk::path_stem()
- Date: Sat, 20 Oct 2018 14:13:38 +0000 (UTC)
commit 53de8b14655bc57bfb1e67244c74519072919188
Author: Hubert Figuière <hub figuiere net>
Date: Sun Oct 14 21:48:48 2018 -0400
fwk: remove fwk::path_stem()
src/fwk/utils/pathutils.cpp | 12 ------------
src/fwk/utils/pathutils.hpp | 5 -----
src/fwk/utils/t/testpathutils.cpp | 2 --
3 files changed, 19 deletions(-)
---
diff --git a/src/fwk/utils/pathutils.cpp b/src/fwk/utils/pathutils.cpp
index b78f51d..a4964b4 100644
--- a/src/fwk/utils/pathutils.cpp
+++ b/src/fwk/utils/pathutils.cpp
@@ -55,18 +55,6 @@ std::string::size_type _path_extension_pos(const std::string &path)
return idx;
}
-/** return the stem of a path, ie basename minus extension
- /foo/bar/baz.txt returns /foo/bar/baz
- */
-std::string path_stem(const std::string & path)
-{
- auto idx = _path_extension_pos(path);
- if(idx == std::string::npos) {
- return path;
- }
- return std::string(path.cbegin(), path.cbegin() + idx);
-}
-
std::string path_dirname(const std::string & path)
{
auto slash_idx = path.find_last_of("/");
diff --git a/src/fwk/utils/pathutils.hpp b/src/fwk/utils/pathutils.hpp
index 979bd5a..fdf80f5 100644
--- a/src/fwk/utils/pathutils.hpp
+++ b/src/fwk/utils/pathutils.hpp
@@ -29,11 +29,6 @@ namespace fwk {
*/
std::string path_basename(const std::string & path);
-/** return the stem of a path, ie basename minus extension
- /foo/bar/baz.txt returns baz
- */
-std::string path_stem(const std::string & path);
-
/** return the dirname of a path and trailing slash removed.
Assume the last component is a file.
/foo/bar/baz.txt returns /foo/bar
diff --git a/src/fwk/utils/t/testpathutils.cpp b/src/fwk/utils/t/testpathutils.cpp
index 0a3cbaf..27bdf97 100644
--- a/src/fwk/utils/t/testpathutils.cpp
+++ b/src/fwk/utils/t/testpathutils.cpp
@@ -27,8 +27,6 @@ TEST(testPathUtils, testPathUtilsSanity)
{
ASSERT_EQ(fwk::path_basename("/foo/bar/baz.txt"), "baz.txt");
- ASSERT_EQ(fwk::path_stem("/foo/bar/baz.txt"), "/foo/bar/baz");
-
ASSERT_EQ(fwk::path_dirname("/foo/bar/"), "/foo/bar");
ASSERT_EQ(fwk::path_dirname("/foo/bar/baz.txt"), "/foo/bar");
ASSERT_EQ(fwk::path_dirname("baz.txt"), ".");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]