aboutsummaryrefslogtreecommitdiff
path: root/src/GlobalLib.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/GlobalLib.cpp')
-rw-r--r--src/GlobalLib.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/GlobalLib.cpp b/src/GlobalLib.cpp
index ce9426d..177f1b9 100644
--- a/src/GlobalLib.cpp
+++ b/src/GlobalLib.cpp
@@ -140,8 +140,11 @@ namespace sibs
}
else
{
- // TODO: Create build path if it doesn't exist
string debugBuildPath = packageDir + "/build/debug";
+ Result<bool> createBuildDirResult = createDirectoryRecursive(debugBuildPath.c_str());
+ if(createBuildDirResult.isErr())
+ return Result<string>::Err(createBuildDirResult);
+
Result<bool> buildFileResult = ninja.createBuildFile(sibsConfig.getPackageName(), sibsConfig.getDependencies(), debugBuildPath.c_str(), linkerFlagCallbackFunc);
if (buildFileResult.isErr())
return Result<string>::Err(buildFileResult.getErrMsg());
@@ -167,23 +170,30 @@ namespace sibs
url += dependency.version;
url += ".tar.gz";
- // TODO: Create library path if it doesn't exist
string libPath = getHomeDir();
libPath += "/.sibs/lib/";
libPath += dependency.name;
libPath += "/";
libPath += dependency.version;
- // TODO: Create archive directory if it doesn't exist
string libArchivedFilePath = getHomeDir();
libArchivedFilePath += "/.sibs/archive/";
libArchivedFilePath += dependency.name;
+ Result<bool> createArchiveDirResult = createDirectoryRecursive(libArchivedFilePath.c_str());
+ if(createArchiveDirResult.isErr())
+ return createArchiveDirResult;
+
libArchivedFilePath += "/";
libArchivedFilePath += dependency.version;
Result<bool> downloadResult = curl::downloadFile(url.c_str(), libArchivedFilePath.c_str());
if(downloadResult.isErr())
return downloadResult;
+ // Create build path. This is done here because we dont want to create it if download fails
+ Result<bool> createLibDirResult = createDirectoryRecursive(libPath.c_str());
+ if(createLibDirResult.isErr())
+ return createLibDirResult;
+
return Archive::extract(libArchivedFilePath.c_str(), libPath.c_str());
}
} \ No newline at end of file