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

Function Platform_SetDefaultCurrentDirectory

src/android/Platform_Android.c:151–172  ·  view source on GitHub ↗

#######################################################################################################################* *-----------------------------------------------------Configuration-------------------------------------------------------* *#########################################################################################################################*/

Source from the content-addressed store, hash-verified

149*-----------------------------------------------------Configuration-------------------------------------------------------*
150*#########################################################################################################################*/
151cc_result Platform_SetDefaultCurrentDirectory(int argc, char **argv) {
152 cc_string dir; char dirBuffer[FILENAME_SIZE + 1];
153 String_InitArray_NT(dir, dirBuffer);
154 JNIEnv* env;
155 Java_GetCurrentEnv(env);
156
157 jobject obj = Java_ICall_Obj(env, JAVA_getGameDataDir, NULL);
158 Java_DecodeString(env, obj, &dir);
159
160 Java_DeleteLocalRef(env, obj);
161 // TODO should be raw path
162 dir.buffer[dir.length] = '\0';
163 Platform_Log1("DATA DIR: %s|", &dir);
164
165 int res = chdir(dir.buffer) == -1 ? errno : 0;
166 if (!res) return 0;
167
168 // show the path to the user
169 // TODO there must be a better way
170 Window_ShowDialog("Failed to set working directory to", dir.buffer);
171 return res;
172}
173
174void GetDeviceUUID(cc_string* str) {
175 JNIEnv* env;

Callers

nothing calls this directly

Calls 3

Java_DecodeStringFunction · 0.85
Platform_Log1Function · 0.85
Window_ShowDialogFunction · 0.50

Tested by

no test coverage detected