diff options
author | Tor Egge <Tor.Egge@online.no> | 2023-07-17 11:25:48 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2023-07-17 11:25:48 +0200 |
commit | 6df873e7de43eac8f3b293f6aa7061ed89ac5865 (patch) | |
tree | 35649466e34ea9f96125a6590b7f2998e8f1627d /vespalib | |
parent | f83345ac5d932a94437d91bfb5ab07cb786f9d81 (diff) |
Remove FastOS_File::Delete().
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/tests/fastos/file_test.cpp | 4 | ||||
-rw-r--r-- | vespalib/src/vespa/fastlib/io/bufferedfile.cpp | 5 | ||||
-rw-r--r-- | vespalib/src/vespa/fastlib/io/bufferedfile.h | 1 | ||||
-rw-r--r-- | vespalib/src/vespa/fastos/file.h | 7 | ||||
-rw-r--r-- | vespalib/src/vespa/fastos/unix_file.cpp | 15 | ||||
-rw-r--r-- | vespalib/src/vespa/fastos/unix_file.h | 2 |
6 files changed, 2 insertions, 32 deletions
diff --git a/vespalib/src/tests/fastos/file_test.cpp b/vespalib/src/tests/fastos/file_test.cpp index 6b58a4a1fd8..ecb35df5d26 100644 --- a/vespalib/src/tests/fastos/file_test.cpp +++ b/vespalib/src/tests/fastos/file_test.cpp @@ -165,7 +165,7 @@ TEST(FileTest, WriteOnlyTest) { ASSERT_EQ(myFile->GetPosition(), 0); EXPECT_LT(myFile->Read(dummyData, 6), 0); EXPECT_TRUE(myFile->Close()); - EXPECT_TRUE(myFile->Delete()); + EXPECT_TRUE(std::filesystem::remove(std::filesystem::path(woFilename))); } TEST(FileTest, ReadWriteTest) { @@ -188,7 +188,7 @@ TEST(FileTest, ReadWriteTest) { EXPECT_EQ(myFile->Read(dummyData2, 6), 0); EXPECT_EQ(myFile->GetPosition(), 6); EXPECT_TRUE(myFile->Close()); - EXPECT_TRUE(myFile->Delete()); + EXPECT_TRUE(std::filesystem::remove(std::filesystem::path(rwFilename))); } TEST(FileTest, ScanDirectoryTest) { diff --git a/vespalib/src/vespa/fastlib/io/bufferedfile.cpp b/vespalib/src/vespa/fastlib/io/bufferedfile.cpp index 6e4036c7bcd..60c8a4a40ef 100644 --- a/vespalib/src/vespa/fastlib/io/bufferedfile.cpp +++ b/vespalib/src/vespa/fastlib/io/bufferedfile.cpp @@ -431,11 +431,6 @@ bool Fast_BufferedFile::Open(unsigned int openFlags, const char * name) return ok; } -bool Fast_BufferedFile::Delete() -{ - return _file->Delete(); -} - void Fast_BufferedFile::alignEndForDirectIO() { while( (_bufi - buf())%MIN_ALIGNMENT ) { diff --git a/vespalib/src/vespa/fastlib/io/bufferedfile.h b/vespalib/src/vespa/fastlib/io/bufferedfile.h index 2a5e0ec7535..8faada61f9d 100644 --- a/vespalib/src/vespa/fastlib/io/bufferedfile.h +++ b/vespalib/src/vespa/fastlib/io/bufferedfile.h @@ -217,7 +217,6 @@ public: * Just forwarded to the real file to support FastOS_FileInterface. */ bool Open(unsigned int, const char*) override; - bool Delete() override; void alignEndForDirectIO(); }; diff --git a/vespalib/src/vespa/fastos/file.h b/vespalib/src/vespa/fastos/file.h index 1a637726e45..9e895f97ad4 100644 --- a/vespalib/src/vespa/fastos/file.h +++ b/vespalib/src/vespa/fastos/file.h @@ -338,13 +338,6 @@ public: int64_t getSize() const { return const_cast<FastOS_FileInterface *>(this)->GetSize(); } /** - * Delete the file. This method requires that the file is - * currently not opened. - * @return Boolean success/failure - */ - virtual bool Delete() = 0; - - /** * Rename/move a file or directory. This method requires that * the file is currently not opened. A move operation is * supported as long as the source and destination reside diff --git a/vespalib/src/vespa/fastos/unix_file.cpp b/vespalib/src/vespa/fastos/unix_file.cpp index 802e85d7609..b35702911d2 100644 --- a/vespalib/src/vespa/fastos/unix_file.cpp +++ b/vespalib/src/vespa/fastos/unix_file.cpp @@ -341,21 +341,6 @@ FastOS_UNIX_File::GetSize() return fileSize; } -bool -FastOS_UNIX_File::Delete(const char *name) -{ - return (unlink(name) == 0); -} - - -bool -FastOS_UNIX_File::Delete() -{ - assert( ! IsOpened()); - - return (unlink(_filename.c_str()) == 0); -} - bool FastOS_UNIX_File::Rename (const char *currentFileName, const char *newFileName) { bool rc = false; diff --git a/vespalib/src/vespa/fastos/unix_file.h b/vespalib/src/vespa/fastos/unix_file.h index 3d1f6b9db3f..d85378ebf1f 100644 --- a/vespalib/src/vespa/fastos/unix_file.h +++ b/vespalib/src/vespa/fastos/unix_file.h @@ -82,12 +82,10 @@ public: bool SetPosition(int64_t desiredPosition) override; int64_t GetPosition() override; int64_t GetSize() override; - bool Delete() override; [[nodiscard]] bool Sync() override; bool SetSize(int64_t newSize) override; void dropFromCache() const override; - static bool Delete(const char *filename); static int GetLastOSError(); static Error TranslateError(const int osError); static std::string getErrorString(const int osError); |