|
| 1 | +#ifndef FILERIX_FILE_UTILS_HPP |
| 2 | +#define FILERIX_FILE_UTILS_HPP |
| 3 | + |
| 4 | +#include <pybind11/pybind11.h> |
| 5 | +#include <pybind11/stl.h> |
| 6 | +#include "filerix/FileSystem/FileUtils.h" |
| 7 | +#include "filerix/FileSystem/FileInfo.h" |
| 8 | + |
| 9 | +namespace py = pybind11; |
| 10 | + |
| 11 | +inline void init_file_utils(py::module_ &m) |
| 12 | +{ |
| 13 | + py::module fileUtils = m.def_submodule("fileUtils", "File utilities module"); |
| 14 | + |
| 15 | + py::class_<FileInfo>(fileUtils, "FileInfo") |
| 16 | + .def_readonly("name", &FileInfo::name) |
| 17 | + .def_readonly("type", &FileInfo::type) |
| 18 | + .def_readonly("path", &FileInfo::path) |
| 19 | + .def_readonly("size", &FileInfo::size) |
| 20 | + .def_readonly("isDirectory", &FileInfo::isDirectory); |
| 21 | + |
| 22 | + py::class_<FileList>(fileUtils, "FileList") |
| 23 | + .def_readonly("files", &FileList::files) |
| 24 | + .def_readonly("count", &FileList::count); |
| 25 | + |
| 26 | + fileUtils.def("copy", &FileUtils::Copy, "Copy a file from source to destination"); |
| 27 | + fileUtils.def("cut", &FileUtils::Cut, "Cut a file from source to destination"); |
| 28 | + fileUtils.def("rename", &FileUtils::Rename, "Rename a file"); |
| 29 | + fileUtils.def("moveTo", &FileUtils::MoveTo, "Move a file to a new location"); |
| 30 | + fileUtils.def("compress", &FileUtils::Compress, "Compress a file"); |
| 31 | + fileUtils.def("decompress", &FileUtils::Decompress, "Decompress a file"); |
| 32 | + |
| 33 | + fileUtils.def("getFiles", &FileUtils::GetFiles, "Get list of files in a directory"); |
| 34 | + fileUtils.def("searchFiles", &FileUtils::SearchFiles, "Search for files in a directory"); |
| 35 | +} |
| 36 | + |
| 37 | +#endif |
0 commit comments