aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2017-12-16 05:10:05 +0100
committerdec05eba <dec05eba@protonmail.com>2017-12-16 05:10:11 +0100
commit9487a0e924a10a1c314cb51afb5f65ced437b1d3 (patch)
tree485b9725588e401d0410224709679aa264f0eac9 /src
parenta198270a69225c7c438915bf806df4a7a9377c67 (diff)
Fix build when not specifying absolute path
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp13
1 files 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<string> 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<bool> buildResult = ninja.build(debugBuildPath.c_str());
if(buildResult.isErr())
{
+ cerr << "Failed to build ninja file: " << buildResult.getErrMsg() << endl;
exit(8);
}