aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/ninja/Ninja.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/backend/ninja/Ninja.cpp b/backend/ninja/Ninja.cpp
index 72c1e80..7fb07bf 100644
--- a/backend/ninja/Ninja.cpp
+++ b/backend/ninja/Ninja.cpp
@@ -85,9 +85,11 @@ namespace backend
{
if(dependencies.empty()) return Result<string>::Ok("");
- // TODO: Global library dir should be created during sibs installation
string globalLibDir = getHomeDir();
globalLibDir += "/.sibs/lib";
+ Result<bool> createGlobalLibDirResult = createDirectoryRecursive(globalLibDir.c_str());
+ if(createGlobalLibDirResult.isErr())
+ return Result<string>::Err(createGlobalLibDirResult);
string globalLibLinkerFlags;
vector<string> pkgConfigDependencies;
@@ -149,6 +151,10 @@ namespace backend
if(sourceFiles.empty())
return Result<bool>::Err("No source files provided");
+ Result<bool> createBuildDirResult = createDirectoryRecursive(savePath);
+ if(createBuildDirResult.isErr())
+ return createBuildDirResult;
+
string ninjaBuildFilePath = savePath;
ninjaBuildFilePath += "/build.ninja";
@@ -253,13 +259,9 @@ namespace backend
return Result<bool>::Err("NOT IMPLEMENTED YET!");
}
- bool fileOverwritten = sibs::fileOverwrite(ninjaBuildFilePath.c_str(), sibs::StringView(result.data(), result.size()));
- if(!fileOverwritten)
- {
- string errMsg = "Failed to overwrite ninja build file: ";
- errMsg += ninjaBuildFilePath;
- return Result<bool>::Err(errMsg);
- }
+ Result<bool> fileOverwriteResult = sibs::fileOverwrite(ninjaBuildFilePath.c_str(), sibs::StringView(result.data(), result.size()));
+ if(fileOverwriteResult.isErr())
+ return fileOverwriteResult;
printf("Created ninja build file: %s\n", ninjaBuildFilePath.c_str());
return Result<bool>::Ok(true);