Skip to content

Commit

Permalink
Fix macOS app bundles again
Browse files Browse the repository at this point in the history
  • Loading branch information
kelpsyberry committed Jan 20, 2024
1 parent 037c1a9 commit 1eccca7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 33 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/build-release-macos-app-bundles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >
Expand All @@ -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: >
Expand All @@ -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: >
Expand All @@ -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
10 changes: 8 additions & 2 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >
Expand All @@ -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
28 changes: 1 addition & 27 deletions frontend/desktop/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit 1eccca7

Please sign in to comment.