Page 1 of 1

Exception while loading

Posted: Sat May 19, 2012 4:38 am
by daedalic
I'm getting an exception thrown during the call to Ogre::ResourceGroupManager::getSingleton().addResourceLocation().
The arguments being passed into the call are "/Users/daedalic/Library/Application Support/iPhone Simulator/5.1/Applications/98EAEF81-FAE8-48FA-8F31-585FDA3BD84C/3DPong iPhone Sim", "Zip", and "Bootstrap".

The exception description is "OGRE EXCEPTION(7:InternalErrorException): /Users/daedalic/Library/Application Support/iPhone Simulator/5.1/Applications/98EAEF81-FAE8-48FA-8F31-585FDA3BD84C/3DPong iPhone Sim - error whilst opening archive: Unable to read zip file. in ZipArchive::checkZzipError at /Users/daedalic/Development/ogre_src_v1-8/OgreMain/src/OgreZip/cpp (line 297)."

The loading of this zip file works fine in the ogre iOS template app and the settings with regard to the resources.cfg and the location of the media directory are the same.

The line in the resources.cfg file is Zip=media/packs/

The media directory is in the same location as the app code and the file is in the right place.

Any idea on what would be causing this problem? Any help is much appreciated!

Re: Exception while loading

Posted: Mon May 21, 2012 8:27 pm
by daedalic
I got around this problem by specifying absolute file paths for everything in resources.cfg, like so:

Code: Select all

When I use a relative path, this code sets up the absolute path:

Code: Select all

if (!Ogre::StringUtil::startsWith(archName, "/", false)) // only adjust relative dirs
                archName = Ogre::String(Ogre::macBundlePath() + "/" + archName);
I'd still prefer to use relative file paths, so any solution to this would be helpful.

Re: Exception while loading

Posted: Fri Aug 10, 2012 2:40 am
by magengyu
I think your problem is similar with mine.

however, I think setting absolute directory only work for simulator. In fact, the .zip files are in the app's root directory.

you can set cfg as:

Code: Select all

Re: Exception while loading

Posted: Fri Aug 10, 2012 10:03 am
by Ologon
I'm pretty sure OSX and iOS don't set the working directory for your app, so your latter approach is correct. (And it's used in the sample template as well)
It works both on the simulator and the iphone for me.

However you should not set absolute paths in the resources.cfg as these are variable. Also make sure you readd the "media" folder to your project cheking "Create folder references for any added folders" and "Copy items" as well.
This solved some file related errors i had with the sample template.

Re: Exception while loading

Posted: Fri Jun 14, 2013 3:21 am
by Gf11speed
I'm seeing this same issue. It was working fine until I manually built the Ogre source and copied over the built OgreMain_d.dll file into my runtime directory. Then I started getting this error. Why would the DLL matter in determining the path location? It works if I use my old DLL.

After digging further into it, I am somehow getting a ERROR_ACCESS_DENIED when trying to read the file in ReadFile(). Odd, because this isn't an Ogre or zzip package. It's msvcr. No idea why I would be able to open the file but get access denied when reading from it. I tried setting my permissions for that file as well as running the Ogre exe as administrator.

Re: Exception while loading

Posted: Wed Jun 19, 2013 6:51 am
by Gf11speed
Found the solution to this problem. Check here: ... f=2&t=1105

Basically building the Ogre dlls and not building the Dependencies to go along with it. Dlls mismatch.