Created a basic file class

main
anulax1225 ago%!(EXTRA string=1 year)
parent 4958edc8b3
commit d48d082e6b
  1. 13
      src/bakatools/file_system/file.cpp
  2. 24
      src/bakatools/file_system/file.h

@ -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);
}
}

@ -0,0 +1,24 @@
#pragma once
#include <bakatoolspch.h>
#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)
};
}
Loading…
Cancel
Save