Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5652 for code/branches


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
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/resource2/src/core/Clock.h

    r3370 r5652  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Reto Grieder
    2424 *   Co-authors:
    25  *      Reto Grieder
     25 *      ...
    2626 *
    2727 */
  • code/branches/resource2/src/core/ConfigFileManager.cc

    r5645 r5652  
    4040namespace orxonox
    4141{
    42     const char* const DEFAULT_CONFIG_FILE = "default.ini";
    43 
    44     ConfigFileManager* ConfigFileManager::singletonPtr_s = 0;
    45 
    4642    SetConsoleCommandShortcutExtern(config).argumentCompleter(0, autocompletion::configvalueclasses()).argumentCompleter(1, autocompletion::configvalues()).argumentCompleter(2, autocompletion::configvalue());
    4743    SetConsoleCommandShortcutExtern(tconfig).argumentCompleter(0, autocompletion::configvalueclasses()).argumentCompleter(1, autocompletion::configvalues()).argumentCompleter(2, autocompletion::configvalue());
     
    339335    void ConfigFile::save() const
    340336    {
    341         boost::filesystem::path filepath(Core::getConfigPath() / this->filename_);
    342 
    343337        std::ofstream file;
    344         file.open(filepath.string().c_str(), std::fstream::out);
     338        file.open((Core::getConfigPathString() + filename_).c_str(), std::fstream::out);
    345339        file.setf(std::ios::fixed, std::ios::floatfield);
    346340        file.precision(6);
     
    479473    ///////////////////////
    480474
     475    ConfigFileManager* ConfigFileManager::singletonPtr_s = 0;
     476
     477    std::string ConfigFileManager::DEFAULT_CONFIG_FILE = "default.ini";
     478
    481479    ConfigFileManager::ConfigFileManager()
    482480         : mininmalFreeType_(ConfigFileType::numberOfReservedTypes)
  • code/branches/resource2/src/core/ConfigFileManager.h

    r3370 r5652  
    307307            void updateConfigValues(ConfigFileType type);
    308308
     309            static std::string DEFAULT_CONFIG_FILE;
     310
    309311        private:
    310312            ConfigFileManager(const ConfigFileManager&);
  • 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.