--- a/QTfrontend/util/FileEngine.cpp Mon Dec 03 18:08:19 2012 +0100
+++ b/QTfrontend/util/FileEngine.cpp Mon Dec 03 23:54:12 2012 +0400
@@ -10,6 +10,7 @@
FileEngine::FileEngine(const QString& filename)
: m_handle(NULL)
+ , m_size(0)
, m_flags(0)
, m_bufferSet(false)
, m_readWrite(false)
@@ -28,8 +29,11 @@
if ((openMode & QIODevice::ReadWrite) == QIODevice::ReadWrite) {
m_handle = PHYSFS_openAppend(m_fileName.toUtf8().constData());
- m_readWrite = true;
- seek(0);
+ if(m_handle)
+ {
+ m_readWrite = true;
+ seek(0);
+ }
}
else if (openMode & QIODevice::WriteOnly) {
@@ -114,12 +118,14 @@
bool FileEngine::mkdir(const QString &dirName, bool createParentDirectories) const
{
Q_UNUSED(createParentDirectories);
+
return PHYSFS_mkdir(dirName.toUtf8().constData()) != 0;
}
bool FileEngine::rmdir(const QString &dirName, bool recurseParentDirectories) const
{
Q_UNUSED(recurseParentDirectories);
+
return PHYSFS_delete(dirName.toUtf8().constData()) != 0;
}
@@ -191,7 +197,6 @@
QDateTime FileEngine::fileTime(FileTime time) const
{
-
switch (time)
{
case QAbstractFileEngine::ModificationTime:
@@ -207,21 +212,21 @@
m_fileName = file.mid(FileEngineHandler::scheme.size());
else
m_fileName = file;
-
PHYSFS_Stat stat;
if (PHYSFS_stat(m_fileName.toUtf8().constData(), &stat) != 0) {
m_size = stat.filesize;
m_date = QDateTime::fromTime_t(stat.modtime);
-// _flags |= QAbstractFileEngine::WriteUserPerm;
+// m_flags |= QAbstractFileEngine::WriteOwnerPerm;
+ m_flags |= QAbstractFileEngine::ReadOwnerPerm;
m_flags |= QAbstractFileEngine::ReadUserPerm;
m_flags |= QAbstractFileEngine::ExistsFlag;
+ m_flags |= QAbstractFileEngine::LocalDiskFlag;
switch (stat.filetype)
{
case PHYSFS_FILETYPE_REGULAR:
m_flags |= QAbstractFileEngine::FileType;
break;
-
case PHYSFS_FILETYPE_DIRECTORY:
m_flags |= QAbstractFileEngine::DirectoryType;
break;