Compare commits
4 Commits
Release-1-
...
main
| Author | SHA1 | Date |
|---|---|---|
|
|
2e2bc87682 | |
|
|
2c895eb5f5 | |
|
|
f606023568 | |
|
|
2397108f63 |
|
|
@ -8,6 +8,8 @@ jobs:
|
||||||
build-release-windows:
|
build-release-windows:
|
||||||
name: Build on Windows ${{ github.event.release.tag_name }}
|
name: Build on Windows ${{ github.event.release.tag_name }}
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions-rs/cargo@v1
|
- uses: actions-rs/cargo@v1
|
||||||
|
|
@ -29,6 +31,8 @@ jobs:
|
||||||
build-release-linux:
|
build-release-linux:
|
||||||
name: Build on Linux ${{ github.event.release.tag_name }}
|
name: Build on Linux ${{ github.event.release.tag_name }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions-rs/cargo@v1
|
- uses: actions-rs/cargo@v1
|
||||||
|
|
|
||||||
36
src/main.rs
36
src/main.rs
|
|
@ -250,7 +250,7 @@ async fn main() {
|
||||||
if !current_exe_path.starts_with(¤t_version_directory) {
|
if !current_exe_path.starts_with(¤t_version_directory) {
|
||||||
// Check if the latest bootstrapper is downloaded
|
// Check if the latest bootstrapper is downloaded
|
||||||
if !latest_bootstrapper_path.exists() {
|
if !latest_bootstrapper_path.exists() {
|
||||||
info("Downloading the latest bootstrapper and restarting");
|
info("Downloading the latest bootstrapper");
|
||||||
// Download the latest bootstrapper
|
// Download the latest bootstrapper
|
||||||
download_file(&http_client, &format!("https://{}/{}-{}", setup_url, latest_client_version, bootstrapper_filename), &latest_bootstrapper_path).await;
|
download_file(&http_client, &format!("https://{}/{}-{}", setup_url, latest_client_version, bootstrapper_filename), &latest_bootstrapper_path).await;
|
||||||
}
|
}
|
||||||
|
|
@ -266,6 +266,7 @@ async fn main() {
|
||||||
debug(&format!("Current Bootstrapper Hash: {}", current_exe_hash.bright_blue()));
|
debug(&format!("Current Bootstrapper Hash: {}", current_exe_hash.bright_blue()));
|
||||||
|
|
||||||
if latest_bootstrapper_hash != current_exe_hash {
|
if latest_bootstrapper_hash != current_exe_hash {
|
||||||
|
info("Starting latest bootstrapper");
|
||||||
// Run the latest bootstrapper ( with the same arguments passed to us ) and exit
|
// Run the latest bootstrapper ( with the same arguments passed to us ) and exit
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
{
|
{
|
||||||
|
|
@ -288,10 +289,20 @@ async fn main() {
|
||||||
// Make sure the latest bootstrapper is executable
|
// Make sure the latest bootstrapper is executable
|
||||||
std::process::Command::new("chmod").arg("+x").arg(latest_bootstrapper_path.to_str().unwrap()).spawn().unwrap();
|
std::process::Command::new("chmod").arg("+x").arg(latest_bootstrapper_path.to_str().unwrap()).spawn().unwrap();
|
||||||
|
|
||||||
info("We need permission to run the latest bootstrapper");
|
let desktop_file_content = &format!("[Desktop Entry]
|
||||||
let mut command = std::process::Command::new(latest_bootstrapper_path);
|
Name=Syntax Launcher
|
||||||
command.args(&args[1..]);
|
Exec={} %u
|
||||||
command.spawn().unwrap();
|
Icon={}
|
||||||
|
Type=Application
|
||||||
|
Terminal=true
|
||||||
|
Version={}
|
||||||
|
MimeType=x-scheme-handler/syntax-player;", latest_bootstrapper_path.to_str().unwrap(), latest_bootstrapper_path.to_str().unwrap(), env!("CARGO_PKG_VERSION"));
|
||||||
|
|
||||||
|
let desktop_file_path = dirs::data_local_dir().unwrap().join("applications").join("syntax-player.desktop");
|
||||||
|
std::fs::write(desktop_file_path, desktop_file_content).unwrap();
|
||||||
|
|
||||||
|
info("Please launch SYNTAX from the website, to continue with the update process.");
|
||||||
|
std::thread::sleep(std::time::Duration::from_secs(20));
|
||||||
}
|
}
|
||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
|
|
||||||
|
|
@ -370,19 +381,16 @@ async fn main() {
|
||||||
{
|
{
|
||||||
// Linux support
|
// Linux support
|
||||||
let desktop_file_content = &format!("[Desktop Entry]
|
let desktop_file_content = &format!("[Desktop Entry]
|
||||||
Name=Syntax Player
|
Name=Syntax Launcher
|
||||||
Exec={} %u
|
Exec={} %u
|
||||||
|
Icon={}
|
||||||
Type=Application
|
Type=Application
|
||||||
Terminal=false
|
Terminal=true
|
||||||
Version={}
|
Version={}
|
||||||
MimeType=x-scheme-handler/syntax-player;", latest_bootstrapper_path.to_str().unwrap(), env!("CARGO_PKG_VERSION"));
|
MimeType=x-scheme-handler/syntax-player;", latest_bootstrapper_path.to_str().unwrap(), latest_bootstrapper_path.to_str().unwrap(), env!("CARGO_PKG_VERSION"));
|
||||||
|
|
||||||
let desktop_file_path = "/usr/share/applications/syntax-player.desktop";
|
|
||||||
|
|
||||||
let mut file = File::create(desktop_file_path).expect("Unable to create desktop file");
|
|
||||||
file.write_all(desktop_file_content.as_bytes())
|
|
||||||
.expect("Unable to write to desktop file");
|
|
||||||
|
|
||||||
|
let desktop_file_path = dirs::data_local_dir().unwrap().join("applications").join("syntax-player.desktop");
|
||||||
|
std::fs::write(desktop_file_path, desktop_file_content).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the AppSettings.xml file
|
// Write the AppSettings.xml file
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue