更新了3.7的代码,调试工作目录设置不起作用,是为什么?
有人解答吗?
找到原因了,3.7改了_checkPath()函数
static void _checkPath()
{
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 = { 0 };
int nNum = WideCharToMultiByte(CP_UTF8, 0, pUtf16ExePath, pUtf16DirEnd-pUtf16ExePath+1, utf8ExeDir, sizeof(utf8ExeDir), nullptr, nullptr);
s_resourcePath = convertPathFormatToUnixStyle(utf8ExeDir);
}
}
s_resourcePath直接强制取$(SolutionDir)$(Configuration).win32\, 怪不得我改工作目录都不起作用,擦擦擦
还原到以前的就可以了
好吧,大神门都用3.7了
改成什么?
static void _checkPath()
{
if (0 == s_resourcePath.length())
{
WCHAR utf16Path = {0};
GetCurrentDirectoryW(sizeof(utf16Path)-1, utf16Path);
char utf8Path = {0};
int nNum = WideCharToMultiByte(CP_UTF8, 0, utf16Path, -1, utf8Path, sizeof(utf8Path), nullptr, nullptr);
s_resourcePath = convertPathFormatToUnixStyle(utf8Path);
s_resourcePath.append("/");
}
}
官网怎么没3.7下载链接