Expression: _wpgmptr != NULL
Expression: _wpgmptr != NULL
用途:得到当前可执行程序的全路径
cocos2dx 3.6(3.7)版本直接强制取$(SolutionDir)$(Configuration).win32\, 改“工作目录”(调试)都不起作用
static void _checkPath() { //s_resourcePath直接强制取$(SolutionDir)$(Configuration).win32\, 怪不得我改工作目录都不起作用 if (0 == s_resourcePath.length()) { WCHAR *pUtf16ExePath = nullptr; _get_wpgmptr(&pUtf16ExePath); // We need only directory part without exe WCHAR *pUtf16DirEnd = wcsrchr(pUtf16ExePath, L'\\'); char utf8ExeDir[CC_MAX_PATH] = { 0 }; int nNum = WideCharToMultiByte(CP_UTF8, 0, pUtf16ExePath, pUtf16DirEnd-pUtf16ExePath+1, utf8ExeDir, sizeof(utf8ExeDir), nullptr, nullptr); s_resourcePath = convertPathFormatToUnixStyle(utf8ExeDir); } }
解决方法:
浙公网安备 33010602011771号