Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 17, 2009, 3:35:34 PM (15 years ago)
Author:
rgrieder
Message:

Modified ResourceLocation to actually find the given paths.
Plus a few small changes.

Location:
code/branches/resource2/src/orxonox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/resource2/src/orxonox/gamestates/GSDedicated.cc

    r3370 r5652  
    2828
    2929#include "GSDedicated.h"
     30
     31#include <iomanip>
     32#include <iostream>
     33#include <boost/bind.hpp>
    3034
    3135#include "util/Debug.h"
     
    3741#include "core/GameMode.h"
    3842#include "network/Server.h"
    39 
    40 #include <iostream>
    41 #include <iomanip>
    42 #include <boost/bind.hpp>
    4343
    4444#ifdef ORXONOX_PLATFORM_UNIX
  • code/branches/resource2/src/orxonox/tools/ResourceCollection.cc

    r5624 r5652  
    3636namespace orxonox
    3737{
     38    CreateFactory(ResourceCollection);
     39
    3840    ResourceCollection::ResourceCollection(BaseObject* creator)
    3941        : BaseObject(creator)
  • code/branches/resource2/src/orxonox/tools/ResourceLocation.cc

    r5624 r5652  
    3030
    3131#include <OgreResourceGroupManager.h>
     32#include <boost/filesystem.hpp>
     33
    3234#include "util/Exception.h"
     35#include "core/Core.h"
    3336#include "core/CoreIncludes.h"
     37#include "core/XMLFile.h"
    3438#include "core/XMLPort.h"
    3539
    3640namespace orxonox
    3741{
     42    CreateFactory(ResourceLocation);
     43
    3844    ResourceLocation::ResourceLocation(BaseObject* creator)
    3945        : BaseObject(creator)
     
    4349        // Default values
    4450        archiveType_ = "FileSystem";
    45         bRecursive_  = false;
     51        bRecursive_  = true;
    4652    }
    4753
     
    6369        if (path_.empty())
    6470            ThrowException(InitialisationFailed, "ResourceLocation: Trying to add one without the path being set");
     71
     72        // Find the path
     73        boost::filesystem::path path;
     74        if (boost::filesystem::exists(Core::getDataPath() / this->getPath()))
     75            path = Core::getDataPath() / this->getPath();
     76        else if (Core::isDevelopmentRun() && boost::filesystem::exists(Core::getExternalDataPath() / this->getPath()))
     77            path = Core::getExternalDataPath() / this->getPath();
     78        else
     79        {
     80            COUT(2) << "Warning: ResourceLocation '" << this->getPath() << "' does not seem to exist" << std::endl;
     81            return;
     82        }
     83
    6584        // Add it to the Ogre paths
    6685        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
    67             this->getPath(), this->getArchiveType(), resourceGroup, this->getRecursive());
     86            path.string(), this->getArchiveType(), resourceGroup, this->getRecursive());
    6887        resourceGroup_ = resourceGroup;
    6988    }
Note: See TracChangeset for help on using the changeset viewer.