Commit dd831245 authored by ledig's avatar ledig

[FIX] identical Path handling with boost::filesystem for every OS

parent bd7b239a
......@@ -24,6 +24,8 @@
#include <string>
#include <boost/filesystem.hpp>
#include "../kernel/WKernel.h"
#include "WGEResourceManager.h"
......@@ -38,9 +40,15 @@ WGEResourceManager::WGEResourceManager()
// (https://fedorahosted.org/liberation-fonts/) to "arial.ttf"
// initialize members
m_regularFont = WKernel::getAppPath() + "/fonts/LiberationMono-Regular.ttf";
m_boldFont = WKernel::getAppPath() + "/fonts/LiberationMono-Bold.ttf";
m_italicFont = WKernel::getAppPath() + "/fonts/LiberationMono-Italic.ttf";
//m_regularFont = WKernel::getAppPath() + "/fonts/LiberationMono-Regular.ttf";
//m_boldFont = WKernel::getAppPath() + "/fonts/LiberationMono-Bold.ttf";
//m_italicFont = WKernel::getAppPath() + "/fonts/LiberationMono-Italic.ttf";
namespace fs = boost::filesystem;
fs::path fontPath = fs::path( WKernel::getAppPath() ) / "fonts";
m_regularFont = fs::path( fontPath / "LiberationMono-Regular.ttf" ).file_string();
m_boldFont = fs::path( fontPath / "LiberationMono-Bold.ttf" ).file_string();
m_italicFont = fs::path( fontPath / "LiberationMono-Italic.ttf" ).file_string();
}
WGEResourceManager::~WGEResourceManager()
......
......@@ -28,6 +28,7 @@
#include <string>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/tokenizer.hpp>
......@@ -82,7 +83,10 @@ std::string WShader::readTextFile( std::string fileName )
{
std::string fileText;
std::ifstream ifs( ( m_shaderPath + fileName ).c_str() );
namespace fs = boost::filesystem;
std::ifstream ifs( ( ( fs::path( m_shaderPath ) / fileName ).file_string() ).c_str() );
// std::ifstream ifs( ( m_shaderPath + fileName ).c_str() );
std::string line;
std::map< std::string, float >::const_iterator mi = m_defines.begin();
......
......@@ -35,6 +35,7 @@
#include <string>
#include <vector>
#include <boost/filesystem.hpp>
#include <boost/thread/xtime.hpp>
#include "WModule.h"
......@@ -169,6 +170,21 @@ void WKernel::findAppPath()
return;
}
if ( m_AppPath != "" )
{
return;
}
// unified version with boost::filesystem
namespace fs = boost::filesystem;
fs::path currentDir( fs::initial_path<fs::path>() );
m_AppPath = currentDir.file_string();
// std::cout << "Set app path to " << m_AppPath << std::endl;
m_shaderPath = fs::path( currentDir / "shaders" ).file_string();
// std::cout << "Set shader path to " << m_shaderPath << std::endl;
/*
// FIXME (schurade)
// this should work on linux, have to implement it for windows and mac later
#ifdef __linux__
......@@ -244,6 +260,7 @@ void WKernel::findAppPath()
// DWORD nSize // size of buffer
// );
#endif
*/
}
const WBoolFlag& WKernel::isFinishRequested() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment