diff --git a/cocos/platform/win32/CCFileUtils-win32.cpp b/cocos/platform/win32/CCFileUtils-win32.cpp index ea3f9e6f12..3469b11e61 100644 --- a/cocos/platform/win32/CCFileUtils-win32.cpp +++ b/cocos/platform/win32/CCFileUtils-win32.cpp @@ -137,7 +137,13 @@ static void _checkPath() if (s_resourcePath.empty()) { WCHAR *pUtf16ExePath = nullptr; - _get_wpgmptr(&pUtf16ExePath); +#ifdef CC_STUDIO_ENABLED_VIEW + WCHAR utf16Path[CC_MAX_PATH] = { 0 }; + GetModuleFileNameW(NULL, utf16Path, CC_MAX_PATH - 1); + pUtf16ExePath = &(utf16Path[0]); +#else + _get_wpgmptr(&pUtf16ExePath); // CocoStudio Notice : This function won't work under studio, will cause a assert in system library +#endif // We need only directory part without exe WCHAR *pUtf16DirEnd = wcsrchr(pUtf16ExePath, L'\\');