Skip to content

Commit 49c5619

Browse files
committed
Remove incorrect assets arg
1 parent e7a0adb commit 49c5619

File tree

4 files changed

+5
-45
lines changed

4 files changed

+5
-45
lines changed

guide/src/shader_objects/locating_assets.md

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -47,37 +47,3 @@ Add a helper function to locate the assets dir, and assign `m_assets_dir` to its
4747
// ...
4848
m_assets_dir = locate_assets_dir();
4949
```
50-
51-
We can also support a command line argument to override this algorithm:
52-
53-
```cpp
54-
// app.hpp
55-
void run(std::string_view assets_dir);
56-
57-
// app.cpp
58-
[[nodiscard]] auto locate_assets_dir(std::string_view const in) -> fs::path {
59-
if (!in.empty()) {
60-
std::println("[lvk] Using custom assets directory: '{}'", in);
61-
return in;
62-
}
63-
// ...
64-
}
65-
66-
// ...
67-
void App::run(std::string_view const assets_dir) {
68-
m_assets_dir = locate_assets_dir(assets_dir);
69-
// ...
70-
}
71-
72-
// main.cpp
73-
auto assets_dir = std::string_view{};
74-
75-
// ...
76-
if (arg == "-x" || arg == "--force-x11") {
77-
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);
78-
}
79-
if (arg == "-a" || arg == "--assets") { assets_dir = arg; }
80-
81-
// ...
82-
lvk::App{}.run(assets_dir);
83-
```

src/app.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ namespace lvk {
1111
using namespace std::chrono_literals;
1212

1313
namespace {
14-
[[nodiscard]] auto locate_assets_dir(std::string_view const in) -> fs::path {
15-
if (!in.empty()) {
16-
std::println("[lvk] Using custom assets directory: '{}'", in);
17-
return in;
18-
}
14+
[[nodiscard]] auto locate_assets_dir() -> fs::path {
1915
// look for '<path>/assets/', starting from the working
2016
// directory and walking up the parent directory tree.
2117
static constexpr std::string_view dir_name_v{"assets"};
@@ -54,8 +50,8 @@ namespace {
5450
}
5551
} // namespace
5652

57-
void App::run(std::string_view const assets_dir) {
58-
m_assets_dir = locate_assets_dir(assets_dir);
53+
void App::run() {
54+
m_assets_dir = locate_assets_dir();
5955

6056
create_window();
6157
create_instance();

src/app.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace fs = std::filesystem;
1313

1414
class App {
1515
public:
16-
void run(std::string_view assets_dir);
16+
void run();
1717

1818
private:
1919
struct RenderSync {

src/main.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@
55

66
auto main(int argc, char** argv) -> int {
77
try {
8-
auto assets_dir = std::string_view{};
98
// skip the first argument.
109
auto args = std::span{argv, static_cast<std::size_t>(argc)}.subspan(1);
1110
while (!args.empty()) {
1211
auto const arg = std::string_view{args.front()};
1312
if (arg == "-x" || arg == "--force-x11") {
1413
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);
1514
}
16-
if (arg == "-a" || arg == "--assets") { assets_dir = arg; }
1715
args = args.subspan(1);
1816
}
19-
lvk::App{}.run(assets_dir);
17+
lvk::App{}.run();
2018
} catch (std::exception const& e) {
2119
std::println(stderr, "PANIC: {}", e.what());
2220
return EXIT_FAILURE;

0 commit comments

Comments
 (0)