attempt to fix LowLevelFile, minor code reuse

deque
greye 11 years ago
parent 2c82da8e6e
commit 6cb795ef7d

@ -206,6 +206,8 @@ size_t LowLevelFile::read (void * data, size_t size)
}
#elif FILE_API == FILE_API_WIN32
#include <boost/locale.hpp>
/*
*
* Implementation of LowLevelFile methods using Win32 API calls
@ -227,7 +229,8 @@ void LowLevelFile::open (char const * filename)
{
assert (mHandle == INVALID_HANDLE_VALUE);
HANDLE handle = CreateFileA (filename, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
std::wstring wname = boost::locale::conv::utf_to_utf<wchar_t>(filename);
HANDLE handle = CreateFileW (wname.c_str(), GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
if (handle == NULL)
{

@ -8,6 +8,8 @@
#include <OgreStringConverter.h>
#include <OgreDataStream.h>
#include <components/files/constrainedfiledatastream.hpp>
using namespace Settings;
namespace bfs = boost::filesystem;
@ -19,15 +21,13 @@ CategorySettingValueMap Manager::mNewSettings = CategorySettingValueMap();
void Manager::loadUser (const std::string& file)
{
bfs::ifstream fin((bfs::path(file)));
Ogre::DataStreamPtr stream((OGRE_NEW Ogre::FileStreamDataStream(file, &fin, false)));
Ogre::DataStreamPtr stream = openConstrainedFileDataStream(file.c_str());
mFile.load(stream);
}
void Manager::loadDefault (const std::string& file)
{
bfs::ifstream fin((bfs::path(file)));
Ogre::DataStreamPtr stream((OGRE_NEW Ogre::FileStreamDataStream(file, &fin, false)));
Ogre::DataStreamPtr stream = openConstrainedFileDataStream(file.c_str());
mDefaultFile.load(stream);
}

Loading…
Cancel
Save