Skip to content

Commit 300bf53

Browse files
committed
Add method to retrieve models directory relative to executable location
1 parent e959496 commit 300bf53

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

.DS_Store

0 Bytes
Binary file not shown.

include/kolosal_cli.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ class KolosalCLI {
6464
*/
6565
std::string getExecutableDirectory();
6666

67+
/**
68+
* @brief Get the models directory relative to the executable location
69+
* @return Path to the models directory
70+
*/
71+
std::string getExecutableModelsDirectory();
72+
6773
/**
6874
* @brief Normalize engine name for cross-platform compatibility
6975
* @param filename The original filename from Hugging Face repository

src/kolosal_cli.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ bool KolosalCLI::processModelDownload(const std::string &modelId, const ModelFil
298298
return true;
299299
}
300300

301-
// Send engine creation request to server
301+
// Send engine creation request to server (server handles download location)
302302
if (!m_serverClient->addEngine(engineId, downloadUrl, "./models/" + modelFile.filename))
303303
{
304304
std::cerr << "Failed to send download request." << std::endl;
@@ -1493,6 +1493,18 @@ std::string KolosalCLI::getExecutableDirectory()
14931493
#endif
14941494
}
14951495

1496+
std::string KolosalCLI::getExecutableModelsDirectory()
1497+
{
1498+
std::string executableDir = getExecutableDirectory();
1499+
if (executableDir.empty())
1500+
{
1501+
return "models"; // fallback to relative path
1502+
}
1503+
1504+
std::filesystem::path modelsPath = std::filesystem::path(executableDir) / "models";
1505+
return std::filesystem::absolute(modelsPath).string();
1506+
}
1507+
14961508
bool KolosalCLI::downloadEngineFile(const std::string& engineName, const std::string& filename)
14971509
{
14981510
// Get the executable directory

0 commit comments

Comments
 (0)