| 170 | } |
| 171 | |
| 172 | std::string ConfigManager::GetBaseCacheDir() const { |
| 173 | std::string cache_dir = GetCacheDir(); |
| 174 | |
| 175 | #ifdef __ANDROID__ |
| 176 | // On Android, use current working directory as base for relative path |
| 177 | std::string expanded_cache_dir = FileUtils::ExpandTilde(cache_dir); |
| 178 | |
| 179 | if (expanded_cache_dir.empty()) { |
| 180 | fprintf(stderr, "Unable to get cache directory path."); |
| 181 | return ""; // Handle error appropriately in your application |
| 182 | } |
| 183 | |
| 184 | // Get current working directory and append the cache path |
| 185 | std::filesystem::path cwd = std::filesystem::current_path(); |
| 186 | std::filesystem::path cache_path = cwd / expanded_cache_dir; |
| 187 | #else |
| 188 | // On other platforms, use the home directory |
| 189 | std::string expanded_cache_dir = FileUtils::ExpandTilde(cache_dir); |
| 190 | |
| 191 | if (expanded_cache_dir.empty()) { |
| 192 | fprintf(stderr, "Unable to get home directory."); |
| 193 | return ""; // Handle error appropriately in your application |
| 194 | } |
| 195 | |
| 196 | std::filesystem::path cache_path(expanded_cache_dir); |
| 197 | #endif |
| 198 | |
| 199 | if (!fs::exists(cache_path)) { |
| 200 | fs::create_directories(cache_path); |
| 201 | } |
| 202 | |
| 203 | return cache_path.string(); |
| 204 | } |
| 205 | |
| 206 | std::string ConfigManager::GetDownloadProvider() const { |
| 207 | return current_config_.download_provider.empty() ? "huggingface" : current_config_.download_provider; |
no test coverage detected