diff --git a/source/dub/packagemanager.d b/source/dub/packagemanager.d index 3b3f335..e3b9ff4 100644 --- a/source/dub/packagemanager.d +++ b/source/dub/packagemanager.d @@ -840,7 +840,7 @@ /// Backward-compatibility for deprecated overload, simplify once `storeFetchedPatch` /// is removed - private Package store_(ubyte[] data, NativePath destination, + protected Package store_(ubyte[] data, NativePath destination, in PackageName name, in Version vers) { import dub.recipe.json : toJson; diff --git a/source/dub/test/base.d b/source/dub/test/base.d index 475dd7e..4218fac 100644 --- a/source/dub/test/base.d +++ b/source/dub/test/base.d @@ -359,6 +359,21 @@ this.scm[GitReference(repo)] = dub_json; } + /// Overriden because we currently don't have a way to do dependency + /// injection on `dub.internal.utils : lockFile`. + public override Package store(ubyte[] data, PlacementLocation dest, + in PackageName name, in Version vers) + { + // Most of the code is copied from the base method + assert(!name.sub.length, "Cannot store a subpackage, use main package instead"); + NativePath dstpath = this.getPackagePath(dest, name, vers.toString()); + this.ensureDirectory(dstpath.parentPath()); + + if (this.existsFile(dstpath)) + return this.getPackage(name, vers, dest); + return this.store_(data, dstpath, name, vers); + } + /// protected override bool existsDirectory(NativePath path) {