Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ladisgin committed Apr 8, 2022
1 parent ce7c7dd commit f308aee
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion server/src/Paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace Paths {
fs::path getCCJsonFileFullPath(const string &filename, const fs::path &directory) {
fs::path path1 = fs::path(filename);
fs::path path2 = fs::weakly_canonical(directory / path1);
return fs::exists(path2) ? path2 : path1;
return fs::exists(path2.parent_path()) ? path2 : path1;
}

bool isPath(const string &possibleFilePath) noexcept {
Expand Down
4 changes: 2 additions & 2 deletions server/src/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,8 +559,7 @@ Status Server::TestsGenServiceImpl::ProcessProjectStubsRequest(BaseTestGen *test
}

Status Server::TestsGenServiceImpl::failedToLoadCDbStatus(const CompilationDatabaseException &e) {
return Status(StatusCode::INVALID_ARGUMENT,
"Failed to find compile_commands.json:\n" + string(e.what()));
return {StatusCode::INVALID_ARGUMENT, "Failed to find compile_commands.json:\n" + string(e.what())};
}

Status Server::TestsGenServiceImpl::PrintModulesContent(ServerContext *context,
Expand Down Expand Up @@ -655,6 +654,7 @@ Status Server::TestsGenServiceImpl::GetProjectTargets(ServerContext *context,
ProjectTargetsWriter targetsWriter{ response };
targetsWriter.writeResponse(projectContext, targets);
} catch (CompilationDatabaseException const &e) {
LOG_S(ERROR) << "Compilation database error: " << e.what();
return failedToLoadCDbStatus(e);
}
return Status::OK;
Expand Down

0 comments on commit f308aee

Please sign in to comment.