From 8d3a83a20a57cd505b2f98a542903a3aee0c2b45 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 29 Apr 2018 12:57:33 +0200 Subject: Change sibs cache directory to standard one, remove library archive when it has been extracted --- src/GlobalLib.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/GlobalLib.cpp') diff --git a/src/GlobalLib.cpp b/src/GlobalLib.cpp index 8618cfd..c577a4a 100644 --- a/src/GlobalLib.cpp +++ b/src/GlobalLib.cpp @@ -282,13 +282,13 @@ namespace sibs if (!libPathResult) return Result::Err(libPathResult); FileString libPath = libPathResult.unwrap(); - libPath += TINYDIR_STRING("/.sibs/lib/"); + libPath += TINYDIR_STRING("/.cache/sibs/lib/"); libPath += toFileString(dependency->name); libPath += TINYDIR_STRING("/"); libPath += toFileString(dependency->version); FileString libArchivedFilePath = libPathResult.unwrap(); - libArchivedFilePath += TINYDIR_STRING("/.sibs/archive/"); + libArchivedFilePath += TINYDIR_STRING("/.cache/sibs/archive/"); libArchivedFilePath += toFileString(dependency->name); Result createArchiveDirResult = createDirectoryRecursive(libArchivedFilePath.c_str()); if(!createArchiveDirResult) @@ -305,7 +305,10 @@ namespace sibs if(!createLibDirResult) return createLibDirResult; - return Archive::extract(libArchivedFilePath.c_str(), libPath.c_str()); + Result archiveExtractResult = Archive::extract(libArchivedFilePath.c_str(), libPath.c_str()); + // We have extracted the archive, we dont need to cache it. If remove fails, it doesn't really matter, user can remove it himself + remove(libArchivedFilePath.c_str()); + return archiveExtractResult; } Result GlobalLib::downloadDependency(GitDependency *dependency) @@ -314,7 +317,7 @@ namespace sibs if (!libPathResult) return Result::Err(libPathResult); FileString libPath = libPathResult.unwrap(); - libPath += TINYDIR_STRING("/.sibs/lib/"); + libPath += TINYDIR_STRING("/.cache/sibs/lib/"); libPath += toFileString(dependency->name); // We dont care if the directory already exists. Nothing will happen if it does -- cgit v1.2.3