I am porting my C++ OpenGL application to iOS, it uses getcwd function to load shaders. In iOS 'getcwd' returns just a slash and I can't do something. Or is there any good method to load files on iOS?
Edit: found a solution! POSIX-based code.
static char homePath[256];
char *DocumentsFolder(void)
{
char *p;
if (*homePath)
return homePath;
if ((p = getenv("HOME")) != NULL) {
strncpy(homePath, p, sizeof(homePath));
strcat(homePath, "/Documents" );
if (mkdir(homePath, 0777)) {
if (errno != EEXIST)
printf( "CAN NOT CREATE DIRECTORY\n" );
}
return homePath;
}
return "";
}