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

Commit 2c9dd80

Browse files
committed
fix: create temp folder when running with root
1 parent 0a3c5da commit 2c9dd80

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

engine/utils/file_manager_utils.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ inline std::filesystem::path GetHomeDirectoryPath() {
7272
}
7373
}
7474
#else
75+
// If running with root
76+
if (!getuid()) {
77+
auto data_folder_path = std::filesystem::temp_directory_path() / "cortex-su";
78+
if (!std::filesystem::exists(data_folder_path)) {
79+
std::filesystem::create_directory(data_folder_path);
80+
}
81+
return data_folder_path;
82+
}
7583
const char* homeDir = std::getenv("HOME");
7684
if (!homeDir) {
7785
throw std::runtime_error("Cannot determine the home directory");

0 commit comments

Comments
 (0)