diff --git a/source/dub/packagemanager.d b/source/dub/packagemanager.d index a7ebcb1..f8a6cdd 100644 --- a/source/dub/packagemanager.d +++ b/source/dub/packagemanager.d @@ -390,7 +390,9 @@ const PackageName pname = parent ? PackageName(parent.name) : PackageName.init; - auto content = readPackageRecipe(recipe, pname, mode); + string text = this.readText(recipe); + auto content = parsePackageRecipe( + text, recipe.toNativeString(), pname, null, mode); auto ret = new Package(content, path, parent, version_); ret.m_infoFile = recipe; return ret; @@ -1222,6 +1224,13 @@ } /// Ditto + protected string readText(NativePath path) + { + static import dub.internal.vibecompat.core.file; + return dub.internal.vibecompat.core.file.readText(path); + } + + /// Ditto protected alias IterateDirDg = int delegate(scope int delegate(ref FileInfo)); /// Ditto diff --git a/source/dub/test/base.d b/source/dub/test/base.d index 38a964b..3566f57 100644 --- a/source/dub/test/base.d +++ b/source/dub/test/base.d @@ -369,36 +369,6 @@ } /** - * Loads a `Package` - * - * This is currently not implemented, and any call to it will trigger - * an assert, as that would otherwise be an access to the filesystem. - */ - protected override Package load(NativePath path, NativePath recipe = NativePath.init, - Package parent = null, string version_ = null, - StrictMode mode = StrictMode.Ignore) - { - if (recipe.empty) - recipe = this.findPackageFile(path); - - enforce(!recipe.empty, - "No package file found in %s, expected one of %s" - .format(path.toNativeString(), - packageInfoFiles.map!(f => cast(string)f.filename).join("/"))); - - const PackageName parent_name = parent - ? PackageName(parent.name) : PackageName.init; - - string text = this.fs.readText(recipe); - auto content = parsePackageRecipe(text, recipe.toNativeString(), - parent_name, null, mode); - - auto ret = new Package(content, path, parent, version_); - ret.m_infoFile = recipe; - return ret; - } - - /** * Re-Implementation of `gitClone`. * * The base implementation will do a `git` clone, to the file-system. @@ -445,6 +415,12 @@ } /// + protected override string readText(NativePath path) + { + return this.fs.readText(path); + } + + /// protected override IterateDirDg iterateDirectory(NativePath path) { enforce(this.fs.existsDirectory(path),