mirror of https://github.com/bjornbytes/lovr.git
Fix desktop game packaging issue;
Accidentally hardcoded it to "assets" when updating Android.
This commit is contained in:
parent
826fc098bc
commit
4160743b77
|
@ -68,7 +68,7 @@ size_t lovrPlatformGetHomeDirectory(char* buffer, size_t size);
|
|||
size_t lovrPlatformGetDataDirectory(char* buffer, size_t size);
|
||||
size_t lovrPlatformGetWorkingDirectory(char* buffer, size_t size);
|
||||
size_t lovrPlatformGetExecutablePath(char* buffer, size_t size);
|
||||
size_t lovrPlatformGetBundlePath(char* buffer, size_t size);
|
||||
size_t lovrPlatformGetBundlePath(char* buffer, size_t size, const char** root);
|
||||
bool lovrPlatformCreateWindow(WindowFlags* flags);
|
||||
bool lovrPlatformHasWindow(void);
|
||||
void lovrPlatformGetWindowSize(int* width, int* height);
|
||||
|
|
|
@ -159,7 +159,7 @@ size_t lovrPlatformGetExecutablePath(char* buffer, size_t size) {
|
|||
}
|
||||
}
|
||||
|
||||
size_t lovrPlatformGetBundlePath(char* buffer, size_t size) {
|
||||
size_t lovrPlatformGetBundlePath(char* buffer, size_t size, const char** root) {
|
||||
jobject activity = state.app->activity->clazz;
|
||||
jclass class = (*state.jni)->GetObjectClass(state.jni, activity);
|
||||
jmethodID getPackageCodePath = (*state.jni)->GetMethodID(state.jni, class, "getPackageCodePath", "()Ljava/lang/String;");
|
||||
|
@ -178,6 +178,7 @@ size_t lovrPlatformGetBundlePath(char* buffer, size_t size) {
|
|||
if (length >= size) return 0;
|
||||
memcpy(buffer, path, length);
|
||||
buffer[length] = '\0';
|
||||
*root = "/assets";
|
||||
return length;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,6 +110,7 @@ size_t lovrPlatformGetExecutablePath(char* buffer, size_t size) {
|
|||
}
|
||||
}
|
||||
|
||||
size_t lovrPlatformGetBundlePath(char* buffer, size_t size) {
|
||||
size_t lovrPlatformGetBundlePath(char* buffer, size_t size, const char** root) {
|
||||
*root = NULL;
|
||||
return lovrPlatformGetExecutablePath(buffer, size);
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ size_t lovrPlatformGetExecutablePath(char* buffer, size_t size) {
|
|||
return _NSGetExecutablePath(buffer, &size32) ? 0 : size32;
|
||||
}
|
||||
|
||||
size_t lovrPlatformGetBundlePath(char* buffer, size_t size) {
|
||||
size_t lovrPlatformGetBundlePath(char* buffer, size_t size, const char** root) {
|
||||
id extension = ((id(*)(Class, SEL, char*)) objc_msgSend)(objc_getClass("NSString"), sel_registerName("stringWithUTF8String:"), "lovr");
|
||||
id bundle = ((id(*)(Class, SEL)) objc_msgSend)(objc_getClass("NSBundle"), sel_registerName("mainBundle"));
|
||||
id path = ((id(*)(id, SEL, char*, id)) objc_msgSend)(bundle, sel_registerName("pathForResource:ofType:"), nil, extension);
|
||||
|
@ -118,5 +118,6 @@ size_t lovrPlatformGetBundlePath(char* buffer, size_t size) {
|
|||
|
||||
memcpy(buffer, cpath, length);
|
||||
buffer[length] = '\0';
|
||||
*root = NULL;
|
||||
return length;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ size_t lovrPlatformGetExecutablePath(char* buffer, size_t size) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
size_t lovrPlatformGetBundlePath(char* buffer, size_t size) {
|
||||
size_t lovrPlatformGetBundlePath(char* buffer, size_t size, const char** root) {
|
||||
*root = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ size_t lovrPlatformGetExecutablePath(char* buffer, size_t size) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
size_t lovrPlatformGetBundlePath(char* buffer, size_t size) {
|
||||
size_t lovrPlatformGetBundlePath(char* buffer, size_t size, const char** root) {
|
||||
*root = NULL;
|
||||
return lovrPlatformGetExecutablePath(buffer, size);
|
||||
}
|
||||
|
|
|
@ -119,7 +119,8 @@ bool lovrFilesystemInit(const char* argExe, const char* argGame, const char* arg
|
|||
lovrFilesystemSetCRequirePath("??;lua_modules/??;deps/??");
|
||||
|
||||
// First, try to mount a bundled archive
|
||||
if (lovrPlatformGetBundlePath(state.source, LOVR_PATH_MAX) && lovrFilesystemMount(state.source, NULL, true, "/assets")) {
|
||||
const char* root = NULL;
|
||||
if (lovrPlatformGetBundlePath(state.source, LOVR_PATH_MAX, &root) && lovrFilesystemMount(state.source, NULL, true, root)) {
|
||||
state.fused = true;
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue