Skip to content

Commit 46f780c

Browse files
Support for legacy Windows systems has been returned (see description or comment of this commit)
To support legacy builds of Windows 10 (1803 and earlier), Windows 8.1, Windows 8, Windows 7, the ability to use curl ("curl.exe") has been added if it is located in the GRU folder. If curl is installed in any other way, you can use it by creating a file "curl.txt" in the GRU folder and writing the full path to the installed "curl.exe" in it. These methods are introduced as test methods (although they may not be).
1 parent 8bc7034 commit 46f780c

File tree

2 files changed

+28
-16
lines changed

2 files changed

+28
-16
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Updater for applications from GitHub
2424

2525
**OS:**
2626

27-
* Version 2.0 and possible new versions: Windows 10 build 1809+ (x64)/11
27+
* Version 2.0 and possible new versions: Windows 10 build 1809+ (x64)/11. However, there is a way to add support for Windows 10 (1803 and earlier builds), Windows 8.1, Windows 8, Windows 7
2828
* Version 1.5.0.1 (1.5-1) and 1.5: Windows 10 (x64)/11, had support Windows 7/8/8.1 (x64), but the correct display of characters in the console is not guaranteed
2929
* [Version 1.4-1 (1.4.0.1)](https://github.com/Zalexanninev15/GRU/releases/tag/1.4.0.1) and earlier versions: Windows 10 (maybe Windows 11), latest version for Windows 7/8/8.1 (x32 and x64)
3030

src/downloader.rs

+27-15
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
use std::process::{Command, Stdio};
1+
use std::fs::File;
2+
use std::io::Read;
3+
use std::path::Path;
4+
use std::process::{ Command, Stdio };
25
use std::process;
36

4-
57
// Download the asset
68

79
// #[tokio::main]
@@ -16,22 +18,32 @@ pub fn download(repo: &str, ver_tag: &str, file: &str, simple_mode: &bool) {
1618

1719
let mut command = Command::new("C:\\Windows\\System32\\curl.exe");
1820

21+
if Path::new(&String::from(format!("{}\\curl.txt", current_dir))).exists() {
22+
let mut file = File::open(String::from(format!("{}\\curl.txt", current_dir))).unwrap();
23+
let mut contents = String::new();
24+
file.read_to_string(&mut contents).unwrap();
25+
command = Command::new(contents);
26+
}
27+
28+
if Path::new(&String::from(format!("{}\\curl.exe", current_dir))).exists() {
29+
command = Command::new(String::from(format!("{}\\curl.exe", current_dir)));
30+
}
31+
1932
if *simple_mode {
2033
command
21-
.arg("-Lo")
22-
.arg(file_name)
23-
.arg(asset)
24-
.arg("--progress-bar")
25-
.stdout(Stdio::inherit())
26-
.stderr(Stdio::inherit());
27-
}
28-
else {
34+
.arg("-Lo")
35+
.arg(file_name)
36+
.arg(asset)
37+
.arg("--progress-bar")
38+
.stdout(Stdio::inherit())
39+
.stderr(Stdio::inherit());
40+
} else {
2941
command
30-
.arg("-Lo")
31-
.arg(file_name)
32-
.arg(asset)
33-
.stdout(Stdio::inherit())
34-
.stderr(Stdio::inherit());
42+
.arg("-Lo")
43+
.arg(file_name)
44+
.arg(asset)
45+
.stdout(Stdio::inherit())
46+
.stderr(Stdio::inherit());
3547
}
3648

3749
let mut child = command.spawn().expect("Failed to start curl process");

0 commit comments

Comments
 (0)