Skip to content

Commit

Permalink
Fix JNI entrypoint on crash, and restore the abbily to delete existin…
Browse files Browse the repository at this point in the history
…g app containers.
  • Loading branch information
modmuss50 committed May 26, 2024
1 parent a05b054 commit 3b3708e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
7 changes: 3 additions & 4 deletions windows/Sources/FabricSandbox/JniEntrypoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import Jni
import WinSDK

@_cdecl("Java_net_fabricmc_sandbox_Main_nativeEntrypoint")
public func entrypoint(env: UnsafeMutablePointer<JNIEnv>, clazz: jclass!) {
public func entrypoint(jni: UnsafeMutablePointer<JNIEnv>, clazz: jclass!) {
do {
try FabricSandbox().run()
} catch {
var jni = env.pointee
let runtimeException = jni.FindClass("java/lang/RuntimeException")!
let _ = jni.ThrowNew(runtimeException, "\(error)")
let runtimeException = jni.pointee.FindClass("java/lang/RuntimeException")!
let _ = jni.pointee.ThrowNew(runtimeException, "\(error)")
}
}
11 changes: 0 additions & 11 deletions windows/Sources/FabricSandbox/String+Jni.swift

This file was deleted.

3 changes: 3 additions & 0 deletions windows/Sources/Sandbox/AppContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public class AppContainer {
}
*/

// Fow now delete an existing container if it exists
let _ = _DeleteAppContainerProfile(name.wide)

var capabilities = attributes.map { $0.sidAttributes }
var sid: PSID? = nil
let result = capabilities.withUnsafeMutableBufferPointer { capabilities in
Expand Down

0 comments on commit 3b3708e

Please sign in to comment.