Skip to content

Commit

Permalink
fix model loading path under binary dir
Browse files Browse the repository at this point in the history
  • Loading branch information
dhbloo committed Jul 21, 2024
1 parent cc6d45a commit 4fd8164
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Rapfi/command/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,16 @@ bool loadConfig()

std::filesystem::path getModelFullPath(std::filesystem::path modelPath)
{
// First try to open from cwd
// First try to open from current working directory
if (std::filesystem::exists(modelPath)) {
return modelPath;
}

// If not succeeded, try to open from config directory if path is relative
if (std::filesystem::path(modelPath).is_relative()) {
std::filesystem::path configModelPath = configPath.remove_filename() / modelPath;
if (std::filesystem::exists(configModelPath))
return configModelPath;
if (modelPath.is_relative()) {
auto modelPathinBinaryDir = CommandLine::binaryDirectory / modelPath;
if (std::filesystem::exists(modelPathinBinaryDir))
return modelPathinBinaryDir;
}

return modelPath;
Expand Down

0 comments on commit 4fd8164

Please sign in to comment.