Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
Michael Pfaff | acb2d38d8a | |
Michael Pfaff | b4b6b292d0 |
|
@ -16,7 +16,7 @@ ramhorns = "0.14"
|
|||
reqwest = { version = "0.11.10", features = ["json"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
tokio = { version = "1.19", features = ["fs", "macros", "process", "rt"] }
|
||||
tokio = { version = "1.19", features = ["fs", "macros", "process", "rt", "rt-multi-thread"] }
|
||||
url = "2.2"
|
||||
windows-sys = { version = "0.42", features = ["Win32_Foundation", "Win32_System_Registry", "Win32_System_WindowsProgramming"] }
|
||||
|
||||
|
|
|
@ -422,7 +422,7 @@ impl<'a> Step<'a> {
|
|||
|
||||
ensure!(
|
||||
err == windows_sys::Win32::Foundation::ERROR_SUCCESS,
|
||||
"RegGetValueA failed"
|
||||
"RegGetValueA failed: {err}"
|
||||
);
|
||||
|
||||
assert!(len <= CAPACITY as u32, "Buffer overflow caught");
|
||||
|
@ -459,13 +459,13 @@ impl<'a> Step<'a> {
|
|||
|
||||
ensure!(
|
||||
err == windows_sys::Win32::Foundation::ERROR_SUCCESS,
|
||||
"RegOpenKeyExA failed"
|
||||
"RegOpenKeyExA failed: {err}"
|
||||
);
|
||||
|
||||
// SAFETY: we just opened the key (which sets the handle) and checked for errors.
|
||||
let hkey = unsafe { hkey.assume_init() };
|
||||
|
||||
ensure!(buffer.len() < u32::MAX as usize, "Buffer is too large");
|
||||
ensure!(buffer.len() < u32::MAX as usize, "Buffer is too large: {}", buffer.len());
|
||||
|
||||
let err = unsafe {
|
||||
windows_sys::Win32::System::Registry::RegSetValueExA(
|
||||
|
@ -480,7 +480,7 @@ impl<'a> Step<'a> {
|
|||
|
||||
ensure!(
|
||||
err == windows_sys::Win32::Foundation::ERROR_SUCCESS,
|
||||
"RegSetValueExA failed"
|
||||
"RegSetValueExA failed: {err}"
|
||||
);
|
||||
|
||||
let err = unsafe {
|
||||
|
@ -489,7 +489,7 @@ impl<'a> Step<'a> {
|
|||
|
||||
ensure!(
|
||||
err == windows_sys::Win32::Foundation::ERROR_SUCCESS,
|
||||
"RegCloseKey failed"
|
||||
"RegCloseKey failed: {err}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
16
src/main.rs
16
src/main.rs
|
@ -43,7 +43,8 @@ pub struct Context {
|
|||
pub reqwest: reqwest::Client,
|
||||
}
|
||||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
//#[tokio::main(flavor = "current_thread")]
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
println!("Bootstrapping...");
|
||||
|
||||
|
@ -81,6 +82,9 @@ async fn main() -> Result<()> {
|
|||
let deno_dir = swtools_path!("deno");
|
||||
//let deno_exe = swtools_path!("deno" / "deno.exe");
|
||||
|
||||
let vscode_zip = swtools_path!("temp" / "vscode.zip");
|
||||
let vscode_dir = swtools_path!("vscode");
|
||||
|
||||
let nppp_pl = [
|
||||
Step::DownloadFile {
|
||||
file: nppp_zip.into(),
|
||||
|
@ -227,6 +231,7 @@ async fn main() -> Result<()> {
|
|||
Step::ExecuteCommand {
|
||||
file: rustup_init.into(),
|
||||
args: &[
|
||||
"-y",
|
||||
"--default-host",
|
||||
"x86_64-pc-windows-gnu",
|
||||
"--default-toolchain",
|
||||
|
@ -256,6 +261,14 @@ async fn main() -> Result<()> {
|
|||
Step::AppendPath(deno_dir.into()),
|
||||
];
|
||||
|
||||
let vscode_pl = [
|
||||
Step::DownloadFile {
|
||||
file: vscode_zip.into(),
|
||||
res: RemoteResource::Url("https://code.visualstudio.com/sha/download?build=stable&os=win32-x64-archive"),
|
||||
},
|
||||
Step::ExtractFile { file: vscode_zip.into(), dest: vscode_dir.into() },
|
||||
];
|
||||
|
||||
let pipelines = [
|
||||
Pipeline::new("Install Notepad++", nppp_pl.as_slice()),
|
||||
Pipeline::new("Install Explorer++", epp_pl.as_slice()),
|
||||
|
@ -268,6 +281,7 @@ async fn main() -> Result<()> {
|
|||
Pipeline::new("Install Rust (nightly)", rust_pl.as_slice()),
|
||||
// TODO: add an option to install from src
|
||||
Pipeline::new("Install Deno (pre-compiled)", deno_pl.as_slice()),
|
||||
Pipeline::new("Install VSCode", vscode_pl.as_slice()),
|
||||
];
|
||||
|
||||
let mut args = std::env::args_os();
|
||||
|
|
Loading…
Reference in New Issue