]> git.ayabusa.dev Git - rusty-slicer.git/commitdiff
added windows support and maybe mac (to test)
authorayabusa <lebgpub@gmail.com>
Sun, 3 Mar 2024 19:23:50 +0000 (20:23 +0100)
committerayabusa <lebgpub@gmail.com>
Sun, 3 Mar 2024 19:23:50 +0000 (20:23 +0100)
README.md
src-tauri/resources/ffmpeg-macos [new file with mode: 0755]
src-tauri/resources/ffmpeg-windows.exe [new file with mode: 0644]
src-tauri/src/main.rs
src-tauri/tauri.linux.conf.json [new file with mode: 0644]
src-tauri/tauri.macos.conf.json [new file with mode: 0644]
src-tauri/tauri.windows.conf.json [new file with mode: 0644]

index 19cc6b68a38cc78825c6ff7489aef0c9565dc8d1..67ea52e3cf976fa46b827a83304ab9bb4e1965a0 100644 (file)
--- a/README.md
+++ b/README.md
@@ -21,4 +21,4 @@ The rust slicer is a rust app powered by the tauri framework. It is currently re
 - [x] Use the file format choosen
 - [ ] Dummy proof
 - [ ] little website
-- [ ] Port to Windows
\ No newline at end of file
+- [x] Port to Windows
\ No newline at end of file
diff --git a/src-tauri/resources/ffmpeg-macos b/src-tauri/resources/ffmpeg-macos
new file mode 100755 (executable)
index 0000000..1c6694a
Binary files /dev/null and b/src-tauri/resources/ffmpeg-macos differ
diff --git a/src-tauri/resources/ffmpeg-windows.exe b/src-tauri/resources/ffmpeg-windows.exe
new file mode 100644 (file)
index 0000000..5626ea7
Binary files /dev/null and b/src-tauri/resources/ffmpeg-windows.exe differ
index a667aaf41bcccc8faaf77b69703926354121d12c..aa9f7dd904d65ad3904f7aff5f5d76380a60793f 100644 (file)
@@ -157,9 +157,21 @@ fn choose_folder() -> String{
 }
 
 fn launch_ffmpeg(app: tauri::AppHandle, args: Vec<String>) {
+    let bin_name = if cfg!(target_os = "macos") {
+        PathBuf::from("ffmpeg-macos")
+      } else if cfg!(windows) {
+        PathBuf::from("ffmpeg-windows.exe")
+      } else if cfg!(unix) {
+        PathBuf::from("ffmpeg-linux")
+      } else {
+        panic!("[RUSTY SLICER] can't find what os it is !")
+      };
+    let mut bin_path = PathBuf::from("resources");
+    bin_path.push(bin_name);
+
     // get the path from the bundled binary
     let resource_path = app.path_resolver()
-      .resolve_resource("resources/ffmpeg-linux")
+      .resolve_resource(bin_path)
       .expect("failed to resolve resource");
 
     println!("using ffmpeg binary : {}\nwith the following argument : {:?}", resource_path.display(), args);
diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json
new file mode 100644 (file)
index 0000000..d31c971
--- /dev/null
@@ -0,0 +1,19 @@
+{
+    "tauri": {
+        "bundle": {
+            "active": true,
+            "targets": "all",
+            "identifier": "dev.ayabusa.slicer",
+            "icon": [
+                "icons/32x32.png",
+                "icons/128x128.png",
+                "icons/128x128@2x.png",
+                "icons/icon.icns",
+                "icons/icon.ico"
+            ],
+            "resources": [
+                "resources/ffmpeg-linux"
+            ]
+        }
+    }
+}
\ No newline at end of file
diff --git a/src-tauri/tauri.macos.conf.json b/src-tauri/tauri.macos.conf.json
new file mode 100644 (file)
index 0000000..2f5fe27
--- /dev/null
@@ -0,0 +1,19 @@
+{
+    "tauri": {
+        "bundle": {
+            "active": true,
+            "targets": "all",
+            "identifier": "dev.ayabusa.slicer",
+            "icon": [
+                "icons/32x32.png",
+                "icons/128x128.png",
+                "icons/128x128@2x.png",
+                "icons/icon.icns",
+                "icons/icon.ico"
+            ],
+            "resources": [
+                "resources/ffmpeg-macos"
+            ]
+        }
+    }
+}
\ No newline at end of file
diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json
new file mode 100644 (file)
index 0000000..f9eb177
--- /dev/null
@@ -0,0 +1,19 @@
+{
+    "tauri": {
+        "bundle": {
+            "active": true,
+            "targets": "all",
+            "identifier": "dev.ayabusa.slicer",
+            "icon": [
+                "icons/32x32.png",
+                "icons/128x128.png",
+                "icons/128x128@2x.png",
+                "icons/icon.icns",
+                "icons/icon.ico"
+            ],
+            "resources": [
+                "resources/ffmpeg-windows.exe"
+            ]
+        }
+    }
+}
\ No newline at end of file