aboutsummaryrefslogtreecommitdiff
path: root/src/download.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/download.rs')
-rw-r--r--src/download.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/download.rs b/src/download.rs
index 8a372ad..75bea57 100644
--- a/src/download.rs
+++ b/src/download.rs
@@ -10,7 +10,7 @@ use zip::ZipArchive;
use super::{
contentdb::{ContentDb, ContentId},
error::{Error, Result},
- minemod::{MineMod, ModId},
+ minemod::{self, ModContainer, ModId},
};
/// A source determines where a mod should be loaded from.
@@ -73,7 +73,7 @@ impl Downloader {
})
}
- pub fn download(&self, source: &Source) -> Result<MineMod> {
+ pub fn download(&self, source: &Source) -> Result<Box<dyn ModContainer>> {
match *source {
Source::Http(ref url) => self.download_http(url),
Source::ContentDb((ref user, ref package)) => {
@@ -96,7 +96,7 @@ impl Downloader {
///
/// The mod is extracted to a temporary directory and has to be copied using
/// [`MineMod::copy_to`].
- pub fn download_http(&self, url: &Url) -> Result<MineMod> {
+ pub fn download_http(&self, url: &Url) -> Result<Box<dyn ModContainer>> {
let mut reader = ureq::request_url("GET", url).call()?.into_reader();
let mut data = Vec::new();
reader.read_to_end(&mut data)?;
@@ -115,6 +115,6 @@ impl Downloader {
archive.extract(self.temp_dir.path())?;
let extracted_path = self.temp_dir.path().join(name);
- MineMod::open(&extracted_path)
+ minemod::open_mod_or_pack(&extracted_path)
}
}