25
25
const char * MOUNT_SUCCESSFULLY = "Successfully mounted: %s";
26
26
const char * MOUNT_FAILED = "Failed to mount: %s";
28
hrFilesystem::hrFilesystem()
32
hrFilesystem::~hrFilesystem()
36
28
bool hrFilesystem::mount(const QString &path)
38
30
QStringList pathElements = path.split('/');
84
79
_cache.insert(filename, archive);
87
bool hrFilesystem::findInCache(const QString &filename, QString &archive)
83
Try to find archive where the file located.
84
@param filename Filename to found.
85
@return Archive name or null string on error.
87
QString hrFilesystem::findInCache(const QString &filename)
89
89
if ( _cache.find(filename) != _cache.end() )
91
archive = _cache[filename];
91
return _cache[filename];
96
94
qWarning() << "Not found " << filename << __FILE__ << __LINE__;
99
* Extract archive name from full path.
100
* @param path a case-sensitive path
101
* @param ext Must be ".lod" or ".snd" or something else
102
* @return Archive name or null string on error.
104
QString hrFilesystem::extractArchnameFromPath(const QString& path, const char* ext)
107
int index = path.indexOf(ext);
112
archive = path.left(index + qstrlen(ext));
113
archive.remove(0, qstrlen(ext) + 1);
119
* Extract filename with path from full path.
120
* @param path a case-sensitive path
121
* @param ext Must be ".lod" or ".snd" or something else
122
* @return Archive name or null string on error.
124
QString hrFilesystem::extractFilenameFromPath(const QString& path, const char* ext)
126
int index = path.indexOf(ext);
131
return path.right(path.length() - index - qstrlen(ext) - 1 );