gonna do pack install and lockfile stuff in a bit
This commit is contained in:
parent
8f1d419b95
commit
bef640be7a
3 changed files with 26 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
|||
/target
|
||||
.DS_Store
|
||||
|
||||
/todo.txt
|
||||
/design.txt
|
||||
/downloads
|
||||
/servers
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use index::{PackDependency, PackIndex};
|
||||
use index::{PackDependency, PackFile, PackIndex};
|
||||
use rc_zip_sync::ReadZip;
|
||||
|
||||
use crate::{
|
||||
|
@ -9,7 +9,7 @@ use crate::{
|
|||
},
|
||||
};
|
||||
|
||||
mod index;
|
||||
pub mod index;
|
||||
mod obtain_pack;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -19,6 +19,7 @@ pub struct PackMetadata {
|
|||
pub java_version: usize,
|
||||
pub minecraft_version: String,
|
||||
pub neo_version: String,
|
||||
pub files_to_download: Vec<PackFile>,
|
||||
}
|
||||
|
||||
pub struct Pack {
|
||||
|
@ -88,10 +89,13 @@ impl Pack {
|
|||
java_version,
|
||||
minecraft_version,
|
||||
neo_version,
|
||||
files_to_download: index.files,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn metadata(&self) -> &PackMetadata {
|
||||
&self.metadata
|
||||
}
|
||||
|
||||
pub fn install(&self, destination: &str, lockfile_destination: &str) {}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
use std::{fs::write, process::exit};
|
||||
use std::{
|
||||
fs::{create_dir, write},
|
||||
process::exit,
|
||||
};
|
||||
|
||||
use yansi::{Paint, hyperlink::HyperlinkExt};
|
||||
|
||||
|
@ -54,13 +57,17 @@ pub fn begin_guided() {
|
|||
.map(|c| if c.is_ascii_alphanumeric() { c } else { '-' })
|
||||
.collect();
|
||||
|
||||
let installation_destination = format!("servers/{escaped_name}");
|
||||
let instance_destination = format!("servers/{escaped_name}");
|
||||
let installation_destination = format!("{instance_destination}/server");
|
||||
let server_config_destination = format!("{instance_destination}/server.toml");
|
||||
let pack_lockfile_destination = format!("{instance_destination}/pack.lock");
|
||||
|
||||
info(format!(
|
||||
"Okay, installing to {}",
|
||||
installation_destination.bold()
|
||||
instance_destination.bold()
|
||||
));
|
||||
|
||||
// Creates all ancestor directories
|
||||
install_neoforge(
|
||||
&java_installation,
|
||||
neoforge_installer,
|
||||
|
@ -69,10 +76,18 @@ pub fn begin_guided() {
|
|||
|
||||
expect_ioerror_bar(
|
||||
write(
|
||||
format!("{installation_destination}/server.toml"),
|
||||
&server_config_destination,
|
||||
ServerConfig::create(&name, java_installation.version, &pack_metadata.neo_version),
|
||||
),
|
||||
"Could not create server.toml config",
|
||||
);
|
||||
success("Created server config");
|
||||
|
||||
expect_ioerror_bar(
|
||||
create_dir(format!("{instance_destination}/backups")),
|
||||
"Could not create backups directory",
|
||||
);
|
||||
success("Created backups directory");
|
||||
|
||||
pack.install(&installation_destination, &pack_lockfile_destination);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue