Fix issue from #567 that stopped videos from working. Clean up some code.

This commit is contained in:
Sacha 2014-07-15 03:21:24 +10:00
parent 6bd044f9be
commit 82536b298c
5 changed files with 62 additions and 68 deletions

View file

@ -153,13 +153,7 @@ bool rFile::Open(const std::string &filename, rFile::OpenMode mode, int access)
bool rFile::Exists(const std::string &file)
{
#ifdef _WIN32
std::wstring wstr = ConvertUTF8ToWString(file);
return GetFileAttributes(wstr.c_str()) != 0xFFFFFFFF;
#else
struct stat buffer;
return (stat (file.c_str(), &buffer) == 0);
#endif
rExists(file);
}
bool rFile::IsOpened() const
@ -215,6 +209,27 @@ bool rRmdir(const std::string &dir)
#endif
}
bool rRename(const std::string &from, const std::string &to)
{
// TODO: Deal with case-sensitivity
#ifdef _WIN32
return (MoveFile(ConvertUTF8ToWString(from).c_str(), ConvertUTF8ToWString(to).c_str()) == TRUE);
#else
return (0 == rename(from.c_str(), to.c_str()));
#endif
}
bool rExists(const std::string &file)
{
#ifdef _WIN32
std::wstring wstr = ConvertUTF8ToWString(file);
return GetFileAttributes(wstr.c_str()) != 0xFFFFFFFF;
#else
struct stat buffer;
return (stat (file.c_str(), &buffer) == 0);
#endif
}
bool rDirExists(const std::string &path)
{
return wxDirExists(fmt::FromUTF8(path));
@ -287,8 +302,6 @@ bool rDir::GetNext(std::string *filename) const
*filename = str.ToStdString();
return res;
}
rFileName::rFileName()
{