fixed slight error in server build

pull/1/head
Perttu Ahola 2011-02-15 22:27:10 +02:00
parent 5cc686c038
commit ff6a348bb1
2 changed files with 14 additions and 5 deletions

View File

@ -172,7 +172,7 @@ else()
if(BUILD_SERVER) if(BUILD_SERVER)
set_target_properties(minetestserver PROPERTIES set_target_properties(minetestserver PROPERTIES
COMPILE_DEFINITIONS "-DSERVER") COMPILE_DEFINITIONS "SERVER")
endif(BUILD_SERVER) endif(BUILD_SERVER)
endif() endif()

View File

@ -20,14 +20,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "tile.h" #include "tile.h"
#include "debug.h" #include "debug.h"
#include "main.h" // for g_settings #include "main.h" // for g_settings
#include "filesys.h"
/*
Gets the path to a texture by first checking if the texture exists
in texture_path and if not, using the data path.
*/
inline std::string getTexturePath(std::string filename) inline std::string getTexturePath(std::string filename)
{ {
std::string texture_path = g_settings.get("texture_path"); std::string texture_path = g_settings.get("texture_path");
if(texture_path == "") if(texture_path != "")
return porting::getDataPath(filename.c_str()); {
else std::string fullpath = texture_path + '/' + filename;
return texture_path + '/' + filename; if(fs::PathExists(fullpath))
return fullpath;
}
return porting::getDataPath(filename.c_str());
} }
TextureSource::TextureSource(IrrlichtDevice *device): TextureSource::TextureSource(IrrlichtDevice *device):