| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #ifndef FILEFUNCTIONS_H
- #define FILEFUNCTIONS_H
- #include <string>
- #include <ctime>
- #include <queue>
- namespace filefunctions
- {
- enum STATUS_CODE
- {
- SC_SUCCESS = 0,
- SC_INVALID_WD, // No or invalid working dir
- SC_INVALID_PATH,
- SC_DISK_FULL,
- SC_DOES_NOT_EXIST,
- SC_ALREADY_EXISTS,
- SC_READ_ONLY,
- SC_IS_DIRECTORY,
- SC_IS_NOT_DIRECTORY,
- SC_OTHER_FAILIURE
- // And so on
- };
- enum COMMAND_FLAGS
- {
- CF_NONE = 0,
- CF_FORCE = 1,
- CF_RELATIVE = 2
- };
- struct File_Struct
- {
- std::string path;
- unsigned int size;
- tm *modified = nullptr;
- tm *taken = nullptr;
- };
- extern std::string filefunctions_wd;
- STATUS_CODE cd (std::string const &path = "", COMMAND_FLAGS flags = CF_NONE);
- STATUS_CODE mv (std::string const &src, std::string const &dest, COMMAND_FLAGS flags = CF_NONE);
- STATUS_CODE mkdir (std::string const &path, COMMAND_FLAGS flags = CF_NONE);
- STATUS_CODE rm (std::string const &path, COMMAND_FLAGS flags = CF_NONE);
- std::string pwd (void);
- std::queue<File_Struct> ls (std::string path = filefunctions_wd);
- }
- #endif // FILEFUNCTIONS_H
|