Generalize remove for dirs and files
This commit is contained in:
parent
64fcd2094a
commit
f746d83141
@ -27,7 +27,6 @@ public:
|
||||
|
||||
virtual std::unique_ptr<OpenFile> createAndOpenFile(const std::string &name, mode_t mode) = 0;
|
||||
virtual void createDir(const std::string &name, mode_t mode) = 0;
|
||||
virtual void rmdir() = 0;
|
||||
|
||||
//TODO Allow alternative implementation returning only children names without more information
|
||||
//virtual std::unique_ptr<std::vector<std::string>> children() const = 0;
|
||||
|
@ -15,7 +15,6 @@ public:
|
||||
|
||||
virtual std::unique_ptr<OpenFile> open(int flags) const = 0;
|
||||
virtual void truncate(off_t size) const = 0;
|
||||
virtual void unlink() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ public:
|
||||
virtual void access(int mask) const = 0;
|
||||
virtual void rename(const boost::filesystem::path &to) = 0;
|
||||
virtual void utimens(const timespec times[2]) = 0;
|
||||
virtual void remove() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ int FilesystemImpl::read(int descriptor, void *buf, size_t count, off_t offset)
|
||||
}
|
||||
|
||||
void FilesystemImpl::write(int descriptor, const void *buf, size_t count, off_t offset) {
|
||||
//printf("Write %d bytes to offset %d\n", count, offset);fflush(stdout);
|
||||
_open_files.get(descriptor)->write(buf, count, offset);
|
||||
}
|
||||
|
||||
@ -114,12 +115,12 @@ void FilesystemImpl::mkdir(const bf::path &path, mode_t mode) {
|
||||
|
||||
void FilesystemImpl::rmdir(const bf::path &path) {
|
||||
auto dir = LoadDir(path);
|
||||
dir->rmdir();
|
||||
dir->remove();
|
||||
}
|
||||
|
||||
void FilesystemImpl::unlink(const bf::path &path) {
|
||||
auto file = LoadFile(path);
|
||||
file->unlink();
|
||||
file->remove();
|
||||
}
|
||||
|
||||
void FilesystemImpl::rename(const bf::path &from, const bf::path &to) {
|
||||
|
Loading…
Reference in New Issue
Block a user