Implémentation plus propre du chemin cross-platform

This commit is contained in:
Mattéo Delabre 2016-03-30 20:37:45 +02:00
parent 1a7c45b6f8
commit 8e30f81801
1 changed files with 5 additions and 8 deletions

View File

@ -1,13 +1,6 @@
#include "resource_manager.hpp" #include "resource_manager.hpp"
#include "whereami.h" #include "whereami.h"
#include <memory> #include <memory>
#define RESOURCE_PATH
#ifdef _WIN32
#define FILE_SEP '\\'
#else
#define FILE_SEP '/'
#endif
ResourceManager::~ResourceManager() { ResourceManager::~ResourceManager() {
textures.clear(); textures.clear();
@ -35,7 +28,11 @@ std::string getCurrentDirectory() {
* le nom est passé en argument * le nom est passé en argument
*/ */
inline std::string getResourcePath(std::string name) { inline std::string getResourcePath(std::string name) {
return getCurrentDirectory() + FILE_SEP + "res" + FILE_SEP + name; #ifdef _WIN32
return getCurrentDirectory() + "\\res\\" + name;
#else
return getCurrentDirectory() + "/res/" + name;
#endif
} }
sf::Texture& ResourceManager::getTexture(std::string name) { sf::Texture& ResourceManager::getTexture(std::string name) {