From f1a80658b08c8b489772052b5569cb1d3086db08 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 4 Nov 2018 04:29:04 +0100 Subject: Store dependencies in different directories depending on target platform This fixed conflicts in cache filepath when building 32-bit and 64-bit project on the same machine or when doing cross compilation. --- src/GlobalLib.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/GlobalLib.cpp') diff --git a/src/GlobalLib.cpp b/src/GlobalLib.cpp index 7f9d949..5c0e16d 100644 --- a/src/GlobalLib.cpp +++ b/src/GlobalLib.cpp @@ -102,7 +102,7 @@ namespace sibs // TODO: If return error is invalid url, then the message should be converted to // invalid package name/version. A check should be done if it is the name or version // that is invalid. - Result downloadDependencyResult = GlobalLib::downloadDependency(gitDependency); + Result downloadDependencyResult = GlobalLib::downloadDependency(gitDependency, parentConfig.platform); if(!downloadDependencyResult) return downloadDependencyResult; @@ -276,6 +276,8 @@ namespace sibs return Result::Err(libPathResult); FileString libPath = libPathResult.unwrap(); libPath += TINYDIR_STRING("/.cache/sibs/lib/"); + libPath += toFileString(asString(platform)); + libPath += TINYDIR_STRING("/"); libPath += toFileString(dependency->name); libPath += TINYDIR_STRING("/"); libPath += toFileString(package.version.toString()); @@ -308,13 +310,15 @@ namespace sibs return archiveExtractResult; } - Result GlobalLib::downloadDependency(GitDependency *dependency) + Result GlobalLib::downloadDependency(GitDependency *dependency, Platform platform) { Result libPathResult = getHomeDir(); if (!libPathResult) return Result::Err(libPathResult); FileString libPath = libPathResult.unwrap(); libPath += TINYDIR_STRING("/.cache/sibs/lib/"); + libPath += toFileString(asString(platform)); + libPath += TINYDIR_STRING("/"); libPath += toFileString(dependency->name); // We dont care if the directory already exists. Nothing will happen if it does -- cgit v1.2.3