From 9487a0e924a10a1c314cb51afb5f65ced437b1d3 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 16 Dec 2017 05:10:05 +0100 Subject: Fix build when not specifying absolute path --- src/main.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c1ce277..3d970f4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -93,9 +93,9 @@ bool isSourceFile(tinydir_file *file) return false; } -bool isPathSubPathOf(const char *path, const string &subPathOf) +bool isPathSubPathOf(const string &path, const string &subPathOf) { - return _tinydir_strncmp(path, subPathOf.c_str(), subPathOf.size()) == 0; + return _tinydir_strncmp(path.c_str(), subPathOf.c_str(), subPathOf.size()) == 0; } int buildProject(int argc, const char **argv) @@ -116,6 +116,14 @@ int buildProject(int argc, const char **argv) if(projectPath.back() != '/') projectPath += "/"; + Result projectRealPathResult = getRealPath(projectPath.c_str()); + if(!projectRealPathResult) + { + cerr << "Failed to get real path for: '" << projectPath << "': " << projectRealPathResult.getErrMsg() << endl; + exit(40); + } + projectPath = projectRealPathResult.unwrap(); + string projectConfFilePath = projectPath; projectConfFilePath += "/project.conf"; validateFilePath(projectConfFilePath.c_str()); @@ -189,6 +197,7 @@ int buildProject(int argc, const char **argv) Result buildResult = ninja.build(debugBuildPath.c_str()); if(buildResult.isErr()) { + cerr << "Failed to build ninja file: " << buildResult.getErrMsg() << endl; exit(8); } -- cgit v1.2.3