SFML community forums

Help => General => Topic started by: Dyno3421 on December 22, 2014, 07:00:28 pm

Title: Thor not able to load resources on Mac OS X 10.10
Post by: Dyno3421 on December 22, 2014, 07:00:28 pm
Hey guys, I'm trying to load some resources using the Resource module from the Thor library, and it doesn't seem to work.  I compiled and looked at the examples in Thor, and they seem to be doing the same thing (failing to load any resource), which tells me the problem is probably in the way I built Thor.  I played around with the build setting in cmake but was unable to get it to work, everything else seems to work fine.  Using the debugger I found that the ResourceKey for any resource never actually gets put in the map in ResourceCache.  I can't figure out why this is happening!

This is what I'm using to test
    thor::ResourceKey<sf::Font> fontKey = thor::Resources::fromFile<sf::Font>("Font/sansation.ttf");
    try
    {
        mFont = resourceCache.acquire(fontKey);
    }
    catch (thor::ResourceLoadingException &e)
    {
        std::cout << e.what() << std::endl;
    }
 
(FYI: The file is most definitely present.)

the output (this is similar to each example in Thor that loads resources)
Failed to load font "Font/sansation.ttf" (failed to create the font face)
Failed to load resource "[FromFile] Font/sansation.ttf"
 

platform: Mac OS X 10.10, Xcode 6.1
compiler: Apple LLVM 6.0, using libc++ and c++11 language dialect
Title: Re: Thor not able to load resources on Mac OS X 10.10
Post by: Hiura on December 22, 2014, 07:31:54 pm
You're mixing runtime error and build time error... this is a runtime error. You're looking for the file in the wrong directory. Have a look at the SFML tutorial for OS X, especially the part about `resourcePath()` if you're using an application bundle. If you're however using a classic unix binary, make sure to launch your executable from the right place (from your terminal).