Skip to content

Commit 3a20472

Browse files
committed
Make Il2Cpp::application.identifier fallback to process name
1 parent 7ac0173 commit 3a20472

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/application.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ namespace Il2Cpp {
2323
* Gets the identifier name of the current application, e.g.
2424
* `com.example.application` on Android.
2525
*
26-
* **This information is not guaranteed to exist.**
26+
* In case the identifier cannot be retrieved, the main module name is
27+
* returned instead, which typically is the process name.
2728
*
2829
* ```ts
2930
* Il2Cpp.perform(() => {
@@ -32,8 +33,8 @@ namespace Il2Cpp {
3233
* });
3334
* ```
3435
*/
35-
get identifier(): string | null {
36-
return unityEngineCall("get_identifier") ?? unityEngineCall("get_bundleIdentifier");
36+
get identifier(): string {
37+
return unityEngineCall("get_identifier") ?? unityEngineCall("get_bundleIdentifier") ?? Process.mainModule.name;
3738
},
3839

3940
/**

0 commit comments

Comments
 (0)