Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trivial: Slightly simplify PackageManager.store #2834

Merged
merged 1 commit into from
Jan 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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),

Check warning on line 790 in source/dub/packagemanager.d

View check run for this annotation

Codecov / codecov/patch

source/dub/packagemanager.d#L790

Added line #L790 was not covered by tests
"%s (%s) needs to be removed from '%s' prior placement."
.format(name, vers, destination));

Check warning on line 792 in source/dub/packagemanager.d

View check run for this annotation

Codecov / codecov/patch

source/dub/packagemanager.d#L792

Added line #L792 was not covered by tests

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

Check warning on line 795 in source/dub/packagemanager.d

View check run for this annotation

Codecov / codecov/patch

source/dub/packagemanager.d#L794-L795

Added lines #L794 - L795 were not covered by tests
logDebug("Extracting from zip.");

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

logDebug("Creating %s", cleanedPath);
if( dst_path.endsWithSlash ){
if (dst_path.endsWithSlash) {

Check warning on line 839 in source/dub/packagemanager.d

View check run for this annotation

Codecov / codecov/patch

source/dub/packagemanager.d#L839

Added line #L839 was not covered by tests
ensureDirectory(dst_path);
} else {
ensureDirectory(dst_path.parentPath);
Expand Down
Loading