Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit f5ea881

Browse files
authored
Revert "Add Tkge::Utilities::GetCurrentExecutablePath() (#25)"
This reverts commit 4640372.
1 parent 4640372 commit f5ea881

File tree

4 files changed

+18
-64
lines changed

4 files changed

+18
-64
lines changed

App/Src/Main.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include <Tkge/Engine.hpp>
33
#include <Tkge/Graphics/Drawable.hpp>
44
#include <Tkge/Graphics/Shader.hpp>
5-
#include <Tkge/Utilities.hpp>
65
#include <klib/assert.hpp>
76
#include <kvf/time.hpp>
87
#include <cmath>
@@ -108,12 +107,12 @@ namespace
108107
}
109108
} // namespace
110109

111-
int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
110+
int main([[maybe_unused]] int argc, char** argv)
112111
{
113112
try
114113
{
115114
KLIB_ASSERT(argc > 0);
116-
const auto assets_path = Upfind(Tkge::Utilities::GetCurrentExecutablePath(), "Assets");
115+
const auto assets_path = Upfind(*argv, "Assets");
117116
Run(assets_path);
118117
}
119118
catch (const std::exception& e)

Lib/Include/Tkge/Utilities.hpp

Lines changed: 0 additions & 24 deletions
This file was deleted.

Lib/Src/AssetLoader.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
#include <Tkge/AssetLoader.hpp>
2-
#include <Tkge/Utilities.hpp>
32
#include <filesystem>
43

4+
#ifdef _WIN32
5+
#ifndef WIN32_MEAN_AND_LEAN
6+
#define WIN32_MEAN_AND_LEAN
7+
#define _AMD64_
8+
#endif
9+
#include <libloaderapi.h>
10+
#include <minwindef.h>
11+
#endif
12+
513
std::vector<std::filesystem::path> Tkge::AssetLoader::GetSearchPaths() const
614
{
715
std::vector<std::filesystem::path> paths{};
816

917
paths.emplace_back(".");
1018

11-
paths.push_back(Tkge::Utilities::GetCurrentExecutablePath());
19+
#ifdef _WIN32
20+
char buffer[MAX_PATH]{};
21+
GetModuleFileNameA(nullptr, buffer, MAX_PATH);
22+
23+
paths.push_back(std::filesystem::path{buffer}.parent_path());
1224
paths.push_back(paths.back() / "Assets");
25+
#else
26+
#endif
1327

1428
return paths;
1529
}

Lib/Src/Utilities.cpp

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)