[SOLVED] Can't find files anymore inside my win32 project

Hey,

I’m working for a project on both OS-X and win32.
Everything worked fine, but now suddenly my win32 project doesn’t find my resources anymore. (OS-X still works)
it was always enough the get files by filename in the resource folder(e.g. “filename.png”), can someone help me to fix the win32 project? I’m using Visual Studio 2013 community

hmm it’s really strange still can’t find any solution for this problem.
i really need help :frowning:

Someone else might able to provide more clarity but you have to make sure the resources are in your search path. To add something to your search path, type: FileUtils::getInstance()->addSearchPath("whatIwantToAdd");. We will be able to help you more, if you run the following in both windows and mac FileUtils::getInstance()->getSearchPaths(); (look at the output in your debugger, ie. visual studio in the watch window) and tell us what is in your search path (my assumption is that it will be only the default resource path.)

hmm somehow it says size of search path vector is 5232312xxx, so no size at all, and any random output for the string at(0) too. So i have no search path anymore lol. how could this happen? :frowning:
how can i fix this, because before i also never added a path inside the code

where can i set the search path for my project again, so it automatically search inside the Resource folder?

CCLOG("%s aaa %d", FileUtils::getInstance()->getSearchPaths()[0], FileUtils::getInstance()->getSearchPaths().size());

aaa is just random stuff.

output= (my project path)/proj.win32/Debug.win32/ aaa 42058024

i have no idea why its in the debug folder lol. no idea how to fix that

i clearly have no solution, think my windows project is destroyed lol

My suggestion is to rebuild the windows project from scratch and add back your files as it sounds like something is seriously wrong if you have nothing in your search path. That said, you can try FileUtils::getInstance()->addSearchPath(""); (I’m unsure if this will work) or for debugging (this is not a permanent solution) add the full path to your resources folder. I would personally go into CCFileUtils-win32.cpp and add a breakpoint somewhere in the _checkPath function as that function is called to get the default path (see whether GetCurrentDirectoryW puts something in the utf16path).

The only other thing I can think of is: is your search path super super long? There is a maximum path size of 512 characters.

I have a search path but this one is : C:/…path to my cocos project…/proj.win32/debug.win32
I don’t know why its the debug folder? but it defenitly doesn’t search inside the Resource folder. It doesn’t work anymore since i’ve updated to the new 3.5 engine from 3.0, I just copied the cocos2d folder from 3.5 to my project to update it.
I think ill just grap a older version of my project and add all my code there lol.

Ok, you can also try to do the following:

In Visual Studio:
Go to the project properties (right click on the project libcocos2d in the Solution Explorer, then Properties on the pop up menu).
Then, under Configuration Properties / Debugging, set Working Directory to $(ProjectDir)

That also might work. I haven’t personally upgraded to cocos2d-x 3.5 yet but it sounds like somehow the working directory got messed up or is wrong. That’s all you have to fix.

hmm, it is already set to $(ProjectDir)
and my project working directory is $(ProjectDir)…\Resources

I had to put

if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)"
xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y

into my projects’ post build event to get it to work after I updated from 3.4

nice!, thank you! it’s working now :smiley:
I’m using 3.6 now