diff --git a/rtc_base/filerotatingstream_unittest.cc b/rtc_base/filerotatingstream_unittest.cc index 16db280d21..375d9a4067 100644 --- a/rtc_base/filerotatingstream_unittest.cc +++ b/rtc_base/filerotatingstream_unittest.cc @@ -195,10 +195,10 @@ TEST_F(MAYBE_FileRotatingStreamTest, WriteOverflowAndRead) { // Tests that the returned file paths have the right folder and prefix. TEST_F(MAYBE_FileRotatingStreamTest, GetFilePath) { Init("FileRotatingStreamTestGetFilePath", kFilePrefix, kMaxFileSize, 20); + // dir_path_ includes a trailing delimiter. + const std::string prefix = dir_path_ + kFilePrefix; for (auto i = 0; i < 20; ++i) { - Pathname path(stream_->GetFilePath(i)); - EXPECT_EQ(0, path.folder().compare(dir_path_)); - EXPECT_EQ(0, path.filename().compare(0, strlen(kFilePrefix), kFilePrefix)); + EXPECT_EQ(0, stream_->GetFilePath(i).compare(0, prefix.size(), prefix)); } } diff --git a/rtc_base/pathutils.cc b/rtc_base/pathutils.cc index b85d14fc08..594deb7f0f 100644 --- a/rtc_base/pathutils.cc +++ b/rtc_base/pathutils.cc @@ -69,24 +69,6 @@ Pathname::Pathname(const std::string& folder, const std::string& filename) Pathname& Pathname::operator=(const Pathname&) = default; Pathname& Pathname::operator=(Pathname&&) = default; -void Pathname::Normalize() { - for (size_t i=0; i= 2) { - pos = folder_.find_last_of(FOLDER_DELIMS, folder_.length() - 2); - } - if (pos != std::string::npos) { - return folder_.substr(0, pos + 1); - } else { - return EMPTY_STR; - } -} - void Pathname::SetFolder(const std::string& folder) { folder_.assign(folder); // Ensure folder ends in a path delimiter diff --git a/rtc_base/pathutils.h b/rtc_base/pathutils.h index b66cf185e3..a7005fc739 100644 --- a/rtc_base/pathutils.h +++ b/rtc_base/pathutils.h @@ -52,16 +52,6 @@ public: Pathname& operator=(const Pathname&); Pathname& operator=(Pathname&&); - // Normalize changes all folder delimiters to folder_delimiter() - void Normalize(); - - // Reset to the empty pathname - void clear(); - - // Returns true if the pathname is empty. Note: this->pathname().empty() - // is always false. - bool empty() const; - // Returns the folder and filename components. If the pathname is empty, // returns a string representing the current directory (as a relative path, // i.e., "."). @@ -69,8 +59,6 @@ public: void SetPathname(const std::string& pathname); void SetPathname(const std::string& folder, const std::string& filename); - std::string folder() const; - std::string parent_folder() const; // SetFolder and AppendFolder will append a folder delimiter, if needed. void SetFolder(const std::string& folder); void AppendFolder(const std::string& folder); diff --git a/rtc_base/pathutils_unittest.cc b/rtc_base/pathutils_unittest.cc index cbd33ed9e1..fae4f0aba5 100644 --- a/rtc_base/pathutils_unittest.cc +++ b/rtc_base/pathutils_unittest.cc @@ -16,29 +16,21 @@ TEST(Pathname, ReturnsDotForEmptyPathname) { std::string(".") + rtc::Pathname::DefaultFolderDelimiter(); rtc::Pathname path("/", ""); - EXPECT_FALSE(path.empty()); - EXPECT_FALSE(path.folder().empty()); EXPECT_TRUE (path.filename().empty()); EXPECT_FALSE(path.pathname().empty()); EXPECT_EQ(std::string("/"), path.pathname()); path.SetPathname("", "foo"); - EXPECT_FALSE(path.empty()); - EXPECT_TRUE (path.folder().empty()); EXPECT_FALSE(path.filename().empty()); EXPECT_FALSE(path.pathname().empty()); EXPECT_EQ(std::string("foo"), path.pathname()); path.SetPathname("", ""); - EXPECT_TRUE (path.empty()); - EXPECT_TRUE (path.folder().empty()); EXPECT_TRUE (path.filename().empty()); EXPECT_FALSE(path.pathname().empty()); EXPECT_EQ(kCWD, path.pathname()); path.SetPathname(kCWD, ""); - EXPECT_FALSE(path.empty()); - EXPECT_FALSE(path.folder().empty()); EXPECT_TRUE (path.filename().empty()); EXPECT_FALSE(path.pathname().empty()); EXPECT_EQ(kCWD, path.pathname());