MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / Window_SaveFileDialog

Function Window_SaveFileDialog

src/android/Window_Android.c:425–449  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423}
424
425cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* save_args) {
426 JNIEnv* env;
427 jvalue args[2];
428 Java_GetCurrentEnv(env);
429 if (!save_args->defaultName.length) return SFD_ERR_NEED_DEFAULT_NAME;
430
431 // save the item to a temp file, which is then (usually) later deleted by intent callback
432 Directory_Create2(FILEPATH_RAW("Exported"));
433
434 cc_string path; char pathBuffer[FILENAME_SIZE];
435 String_InitArray(path, pathBuffer);
436 String_Format2(&path, "Exported/%s%c", &save_args->defaultName, save_args->filters[0]);
437 save_args->Callback(&path);
438 // TODO kinda ugly, maybe a better way?
439 cc_string file = String_UNSAFE_SubstringAt(&path, String_IndexOf(&path, '/') + 1);
440
441 args[0].l = Java_AllocString(env, &path);
442 args[1].l = Java_AllocString(env, &file);
443 int OK = Java_ICall_Int(env, JAVA_saveFileDialog, args);
444 Java_DeleteLocalRef(env, args[0].l);
445 Java_DeleteLocalRef(env, args[1].l);
446
447 // TODO: Better error handling
448 return OK ? 0 : ERR_INVALID_ARGUMENT;
449}
450
451void Window_AllocFramebuffer(struct Bitmap* bmp, int width, int height) {
452 bmp->scan0 = (BitmapCol*)Mem_Alloc(width * height, BITMAPCOLOR_SIZE, "window pixels");

Callers

nothing calls this directly

Calls 4

String_Format2Function · 0.85
Java_AllocStringFunction · 0.85
Directory_Create2Function · 0.50

Tested by

no test coverage detected