diff --git a/src/bakatools/file_system/file.cpp b/src/bakatools/file_system/file.cpp new file mode 100644 index 0000000..56351a1 --- /dev/null +++ b/src/bakatools/file_system/file.cpp @@ -0,0 +1,13 @@ +#include "file.h" + +namespace Bk::Tools { + int File::remove() + { + return std::filesystem::remove(ent.path()); + } + + void File::copy(std::string path, CopyOption opt) + { + if (exists()) std::filesystem::copy_file(ent.path(), path, opt); + } +} \ No newline at end of file diff --git a/src/bakatools/file_system/file.h b/src/bakatools/file_system/file.h new file mode 100644 index 0000000..cd6b637 --- /dev/null +++ b/src/bakatools/file_system/file.h @@ -0,0 +1,24 @@ +#pragma once + +#include +#include "dir_entry.h" + +namespace Bk::Tools { + class File : public DirEntry + { + public: + File(std::string path) + : DirEntry(path) + {} + + File(std::filesystem::directory_entry ent) + : DirEntry(ent) {} + + virtual ~File() {} + + int remove() override; + void copy(std::string path, CopyOption opt = CopyOption::overwrite_existing) override; + + BK_DIR_ENTRY_TYPE(regular) + }; +} \ No newline at end of file