-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpaths_example.cpp
More file actions
38 lines (32 loc) · 1.37 KB
/
Copy pathpaths_example.cpp
File metadata and controls
38 lines (32 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// -----------------------------------------------------------------------------
// Copyright (c) 2026 @DMsuDev. Licensed under the MIT License.
// See LICENSE file in the project root for full license text.
// -----------------------------------------------------------------------------
#include "foundry/platform/paths.h"
#include <iostream>
int main()
{
// --- Working directory ---------------------------------------------------
auto cwd = foundry::platform::working_directory();
if (cwd.empty()) {
std::cerr << "[paths] Could not determine working directory.\n";
} else {
std::cout << "Working directory : " << cwd << "\n";
}
// --- Executable path -----------------------------------------------------
try {
auto exe = foundry::platform::executable_path();
std::cout << "Executable path : " << exe << "\n";
std::cout << "Executable dir : " << exe.parent_path() << "\n";
} catch (const std::exception& e) {
std::cerr << "[paths] executable_path() failed: " << e.what() << "\n";
}
// --- Temp directory -------------------------------------------------------
auto tmp = foundry::platform::temp_directory();
if (tmp.empty()) {
std::cerr << "[paths] Could not determine temp directory.\n";
} else {
std::cout << "Temp directory : " << tmp << "\n";
}
return 0;
}