Skip to content

Commit

Permalink
Trivial: Slightly simplify PackageManager.store
Browse files Browse the repository at this point in the history
  • Loading branch information
Geod24 authored and thewilsonator committed Jan 28, 2024
1 parent fa26ee3 commit 374842d
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions source/dub/packagemanager.d
Original file line number Diff line number Diff line change
Expand Up @@ -787,18 +787,12 @@ class PackageManager {
logDebug("Placing package '%s' version '%s' to location '%s' from file '%s'",
name, vers, destination.toNativeString(), src.toNativeString());

if( existsFile(destination) ){
throw new Exception(format("%s (%s) needs to be removed from '%s' prior placement.",
name, vers, destination));
}

// open zip file
ZipArchive archive;
{
logDebug("Opening file %s", src);
archive = new ZipArchive(readFile(src));
}
enforce(!existsFile(destination),
"%s (%s) needs to be removed from '%s' prior placement."
.format(name, vers, destination));

logDebug("Opening file %s", src);
ZipArchive archive = new ZipArchive(readFile(src));
logDebug("Extracting from zip.");

// In a GitHub zip, the actual contents are in a sub-folder
Expand Down Expand Up @@ -842,7 +836,7 @@ class PackageManager {
auto dst_path = destination ~ cleanedPath;

logDebug("Creating %s", cleanedPath);
if( dst_path.endsWithSlash ){
if (dst_path.endsWithSlash) {
ensureDirectory(dst_path);
} else {
ensureDirectory(dst_path.parentPath);
Expand Down

0 comments on commit 374842d

Please sign in to comment.