diff --git a/src/app/core/utils/file_util.cc b/src/app/core/utils/file_util.cc new file mode 100644 index 00000000..b0436d65 --- /dev/null +++ b/src/app/core/utils/file_util.cc @@ -0,0 +1,25 @@ +#include "file_util.h" + +#if defined(_WIN32) +#include +#else +#include +#include +#endif + +#include +#include + +namespace yaze { +namespace app { +namespace core { + +std::string LoadFile(const std::string& filename) { + std::string contents; + // TODO: Load a file based on the platform and add error handling + return contents; +} + +} // namespace core +} // namespace app +} // namespace yaze \ No newline at end of file diff --git a/src/app/core/utils/file_util.h b/src/app/core/utils/file_util.h new file mode 100644 index 00000000..a8bfd49b --- /dev/null +++ b/src/app/core/utils/file_util.h @@ -0,0 +1,32 @@ +#ifndef YAZE_APP_CORE_UTILS_FILE_UTIL_H +#define YAZE_APP_CORE_UTILS_FILE_UTIL_H + +#include + +namespace yaze { +namespace app { +namespace core { + +std::string GetFileExtension(const std::string& filename) { + size_t dot = filename.find_last_of("."); + if (dot == std::string::npos) { + return ""; + } + return filename.substr(dot + 1); +} + +std::string GetFileName(const std::string& filename) { + size_t slash = filename.find_last_of("/"); + if (slash == std::string::npos) { + return filename; + } + return filename.substr(slash + 1); +} + +std::string LoadFile(const std::string& filename); + +} // namespace core +} // namespace app +} // namespace yaze + +#endif // YAZE_APP_CORE_UTILS_FILE_UTIL_H \ No newline at end of file