From 0fbf4fd2cd6591395f8e3ee5a7f1299383e896c7 Mon Sep 17 00:00:00 2001 From: Jonas_Jones <91549607+J-onasJones@users.noreply.github.com> Date: Tue, 25 Apr 2023 23:22:01 +0200 Subject: [PATCH] added project structure I think --- PKGBUILD | 28 ++++++++++++++++++++++++++++ run.sh | 1 + src/main.rs | 8 ++++---- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 PKGBUILD create mode 100755 run.sh diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..2326045 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,28 @@ +# Maintainer: Jonas_Jones https://jonasjones.me +pkgname="dayz-linux-gui-launcher-git" +pkgver="0.0.1" +pkgrel=1 +pkgdesc="A gui using the dayz-linux-cli-launcher" +arch=('any') +depends=("dayz-linux-cli-launcher") +makedepends=("cargo") +license=("Right to modify") + +prepare() { + cargo fetch --locked --target "$CARCH-unknown-linux-gnu" +} + +build() { + export RUSTUP_TOOLCHAIN=stable + export CARGO_TARGET_DIR=target + cargo build --frozen --release --all-features +} + +check() { + export RUSTUP_TOOLCHAIN=stable + cargo test --frozen --all-features +} + +package() { + install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/$pkgname" +} \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..0f4c3cf --- /dev/null +++ b/run.sh @@ -0,0 +1 @@ +cargo run \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 10c734c..006d2cf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,9 +10,9 @@ use std::fmt; fn main() -> Result<(), eframe::Error> { let config_dir = UserDirs::new().unwrap().home_dir().to_str().unwrap().to_string() + "/.config/dayz-linux-gui-launcher"; - let local_dir = UserDirs::new().unwrap().home_dir().to_str().unwrap().to_string() + "/.local/share/dayz-linux-gui-launcher"; + let dayz_cli_script = "/usr/bin"; // run the setup function - setup(&config_dir, &local_dir); + setup(&config_dir, &dayz_cli_script.to_string()); let options = eframe::NativeOptions { // Hide the OS-specific "chrome" around the window: decorated: false, @@ -138,9 +138,9 @@ fn load_profile(config_dir: &String, profile_name: &String) -> (String, String, fn launch(playername: &String, serverip: &String, serverport: &String, queryport: &String, steamexe: &String, customsteamexe: &String) { // command structure: ./dayz-launcher.sh --steam <"" if default | flatpak if Flatpak | "/path/to/executable" if custom> --launch --name --server serverip:serverport --port - let local_dir = UserDirs::new().unwrap().home_dir().to_str().unwrap().to_string() + "/.local/share/dayz-linux-gui-launcher"; + let dayz_cli_script = "/usr/bin"; // create command - let mut command = Command::new(local_dir + "/dayz-launcher.sh"); + let mut command = Command::new(dayz_cli_script.to_string() + "/dayz-launcher"); if steamexe == "default" { command.arg("\"\""); } else if steamexe == "flatpak" {