Skip to content

Commit b894450

Browse files
yurivictjwcolin
authored andcommitted
common : Define cache directory on FreeBSD (ggml-org#12892)
1 parent d24caf8 commit b894450

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

common/common.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ std::string fs_get_cache_directory() {
850850
if (getenv("LLAMA_CACHE")) {
851851
cache_directory = std::getenv("LLAMA_CACHE");
852852
} else {
853-
#ifdef __linux__
853+
#if defined(__linux__) || defined(__FreeBSD__)
854854
if (std::getenv("XDG_CACHE_HOME")) {
855855
cache_directory = std::getenv("XDG_CACHE_HOME");
856856
} else {
@@ -860,7 +860,9 @@ std::string fs_get_cache_directory() {
860860
cache_directory = std::getenv("HOME") + std::string("/Library/Caches/");
861861
#elif defined(_WIN32)
862862
cache_directory = std::getenv("LOCALAPPDATA");
863-
#endif // __linux__
863+
#else
864+
# error Unknown architecture
865+
#endif
864866
cache_directory = ensure_trailing_slash(cache_directory);
865867
cache_directory += "llama.cpp";
866868
}

0 commit comments

Comments
 (0)