I’m currently using
#ifdef WIN32
CCFileUtils::setResourcePath("./Resource/");
#endif
instead of xopy’ing my assets to the Debug.win32 directory every build. Is there a reason why I should not be doing this?
I also discovered that the default resource path location is not the current working directory of the executable but the directory where the executable/dll/module is located in.
Thanks,
ppl
If anyone else is looking for this… here it is:
// cocos2d-0.99.5-x-0.7.2-rc\cocos2dx\platform\win32\CCXFileUtils_win32.cpp
// [...]
void _CheckPath()
{
if (! s_pszResourcePath[0])
{
WCHAR wszPath[MAX_PATH];
int nNum = WideCharToMultiByte(CP_ACP, 0, wszPath,
GetModuleFileName(NULL, wszPath, MAX_PATH),
s_pszResourcePath, MAX_PATH, NULL, NULL);
for (int i = nNum; i >= 0; --i)
{
if (L'\\' == s_pszResourcePath[i])
{
s_pszResourcePath[i + 1] = 0;
break;
}
}
}
}