aboutsummaryrefslogtreecommitdiff
path: root/src/path_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/path_utils.cpp')
-rw-r--r--src/path_utils.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/path_utils.cpp b/src/path_utils.cpp
index df35ef1..94bbba5 100644
--- a/src/path_utils.cpp
+++ b/src/path_utils.cpp
@@ -1,4 +1,5 @@
#include "path_utils.hpp"
+#include <iostream>
#include <optional>
#include <filesystem>
#ifdef _WIN32
@@ -18,3 +19,16 @@ std::optional<std::filesystem::path> engine::path_utils::exe_path() noexcept {
# error "operating system not supported"
#endif
}
+
+engine::path_utils::Paths::Paths() noexcept {
+ const auto exe_path_opt = engine::path_utils::exe_path();
+ if (!exe_path_opt) {
+ std::cerr << "cannot find path of executable" << std::endl;
+ exit(1);
+ }
+ const auto files_root = (*exe_path_opt).parent_path();
+
+ m_assets_objs = files_root / std::filesystem::relative(PKGDATADIR "/assets/objs", BINDIR);
+ m_assets_textures = files_root / std::filesystem::relative(PKGDATADIR "/assets/textures", BINDIR);
+ m_spvshaders = files_root / std::filesystem::relative(SPVSHADERSDIR, BINDIR);
+}