0

C++ OpenGL アプリケーションを iOS に移植しています。getcwd 関数を使用してシェーダーをロードします。iOS では「getcwd」はスラッシュだけを返し、何もできません。または、iOS でファイルをロードする良い方法はありますか?

編集:解決策を見つけました!POSIX ベースのコード。

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 ""; 
}
4

0 に答える 0