From 1eccca7d74f6441c30ba61a48de11e1d56510a8a Mon Sep 17 00:00:00 2001 From: kelpsyberry <138107494+kelpsyberry@users.noreply.github.com> Date: Sat, 20 Jan 2024 02:54:02 +0100 Subject: [PATCH] Fix macOS app bundles again --- .../build-release-macos-app-bundles.yml | 14 +++++++--- .github/workflows/build-release.yml | 10 +++++-- frontend/desktop/src/main.rs | 28 +------------------ 3 files changed, 19 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build-release-macos-app-bundles.yml b/.github/workflows/build-release-macos-app-bundles.yml index d738ba9..2ab162d 100644 --- a/.github/workflows/build-release-macos-app-bundles.yml +++ b/.github/workflows/build-release-macos-app-bundles.yml @@ -49,7 +49,7 @@ jobs: cp frontend/desktop/platform/macos/Info.plist Dust.app/Contents cp frontend/desktop/platform/macos/Dust.icns Dust.app/Contents/Resources cp -R frontend/desktop/fonts Dust.app/Contents/Resources - cp -R render/wgpu-2d/src/common/shaders Dust.app/Contents/shaders + cp -R render/wgpu-2d/src/common/shaders Dust.app/Contents/Resources - name: Build release bundle (no debugging features) run: > @@ -75,11 +75,13 @@ jobs: -create -output Dust.app/Contents/MacOS/Dust + tar -cvf Dust.app.tar Dust.app + - name: Upload release bundle (no debugging features) uses: actions/upload-artifact@v4 with: name: macOS-app - path: Dust.app + path: Dust.app.tar - name: Build release bundle (debugging features) run: > @@ -104,12 +106,14 @@ jobs: target/aarch64-apple-darwin/ci/dust-desktop -create -output Dust.app/Contents/MacOS/Dust + + tar -cvf Dust.app.tar Dust.app - name: Upload release bundle (debugging features) uses: actions/upload-artifact@v4 with: name: macOS-app-debug - path: Dust.app + path: Dust.app.tar - name: Build release bundle (debugging features + GDB) run: > @@ -136,9 +140,11 @@ jobs: -output Dust.app/Contents/MacOS/Dust cp -R frontend/desktop/src/emu/gdb_server/specs Dust.app/Contents/Resources + + tar -cvf Dust.app.tar Dust.app - name: Upload release bundle (debugging features + GDB) uses: actions/upload-artifact@v4 with: name: macOS-app-debug-gdb - path: Dust.app + path: Dust.app.tar diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 851c994..b1da3fb 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -89,12 +89,15 @@ jobs: --no-default-features --features=${{ env.DEBUG_FEATURES }} --package dust-desktop + + tar -cvf dust-desktop.tar + target/${{ matrix.target }}/ci/dust-desktop${{ matrix.artifact-extension }} - name: Upload release binary (debugging features) uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact }}-debug - path: target/${{ matrix.target }}/ci/dust-desktop${{ matrix.artifact-extension }} + path: dust-desktop.tar - name: Build release binary (debugging features + GDB) run: > @@ -105,9 +108,12 @@ jobs: --no-default-features --features=${{ env.DEBUG_GDB_FEATURES }} --package dust-desktop + + tar -cvf dust-desktop.tar + target/${{ matrix.target }}/ci/dust-desktop${{ matrix.artifact-extension }} - name: Upload release binary (debugging features + GDB) uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact }}-debug-gdb - path: target/${{ matrix.target }}/ci/dust-desktop${{ matrix.artifact-extension }} + path: dust-desktop.tar diff --git a/frontend/desktop/src/main.rs b/frontend/desktop/src/main.rs index 1dbbac4..31a35ac 100644 --- a/frontend/desktop/src/main.rs +++ b/frontend/desktop/src/main.rs @@ -39,32 +39,6 @@ mod emu; mod ui; fn main() { - #[cfg(all(target_os = "macos", app_bundle))] - { - use cocoa::{ - base::{id, nil}, - foundation::{NSBundle, NSString}, - }; - use std::{env::set_current_dir, ffi::CStr}; - let path = (|| unsafe { - let main_bundle = id::mainBundle(); - if main_bundle == nil { - return None; - } - let resource_path = main_bundle.resourcePath(); - if resource_path == nil { - return None; - } - let result = CStr::from_ptr(resource_path.UTF8String()) - .to_str() - .ok() - .map(str::to_string); - let _: () = msg_send![resource_path, release]; - result - })() - .expect("Couldn't get bundle resource path"); - set_current_dir(path).expect("Couldn't change working directory to bundle resource path"); - } - + emu_utils::setup_current_dir(); ui::main(); }