Skip to content

Commit

Permalink
Rename vfs to virtualpaths
Browse files Browse the repository at this point in the history
  • Loading branch information
Lymia committed Jan 30, 2025
1 parent 83b8cd7 commit 55ef6a7
Show file tree
Hide file tree
Showing 28 changed files with 81 additions and 81 deletions.
4 changes: 2 additions & 2 deletions 3rd_party/oxygine-framework/oxygine/res/ResAtlasGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "coreengine/gameconsole.h"
#include "coreengine/settings.h"
#include "coreengine/vfs.h"
#include "coreengine/virtualpaths.h"

namespace oxygine
{
Expand Down Expand Up @@ -66,7 +66,7 @@ namespace oxygine
qint32 columns = 0;
qint32 rows = 0;
QImage img;
QString imgFilePath = Vfs::find(walker.getPath("file"));
QString imgFilePath = VirtualPaths::find(walker.getPath("file"));
if (QFile::exists(imgFilePath))
{
img = QImage(imgFilePath);
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ set(${PROJECT_NAME}_SRCS
coreengine/gameversion.h coreengine/gameversion.cpp
coreengine/refobject.h
coreengine/jsthis.h coreengine/jsthis.cpp
coreengine/vfs.h coreengine/vfs.cpp
coreengine/virtualpaths.h coreengine/virtualpaths.cpp

# network engine
network/smtpmailsender.h network/smtpmailsender.cpp
Expand Down Expand Up @@ -1047,7 +1047,7 @@ set(AppHeadersCxx
coreengine/scriptvariables.h
coreengine/settings.h
coreengine/userdata.h
coreengine/vfs.h
coreengine/virtualpaths.h
game/building.h
game/co.h
game/gameaction.h
Expand Down
4 changes: 2 additions & 2 deletions ai/coreai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "coreengine/gameconsole.h"
#include "coreengine/globalutils.h"
#include "coreengine/vfs.h"
#include "coreengine/virtualpaths.h"

#include "resource_management/cospritemanager.h"
#include "resource_management/weaponmanager.h"
Expand Down Expand Up @@ -170,7 +170,7 @@ void CoreAI::loadIni(QString file)
{
return;
}
QStringList searchFiles = Vfs::findAll("resources/aidata/" + file);
QStringList searchFiles = VirtualPaths::findAll("resources/aidata/" + file);
for (auto & file : searchFiles)
{
if (QFile::exists(file))
Expand Down
8 changes: 4 additions & 4 deletions coreengine/audiomanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "coreengine/gameconsole.h"
#include "coreengine/interpreter.h"
#include "coreengine/globalutils.h"
#include "coreengine/vfs.h"
#include "coreengine/virtualpaths.h"

#include <QFile>
#include <QFileInfo>
Expand Down Expand Up @@ -134,7 +134,7 @@ void AudioManager::createSoundCache()
{
if (Mainapp::getInstance()->isAudioThread())
{
auto searchPath = Vfs::createSearchPathRev("resources/sounds/");
auto searchPath = VirtualPaths::createSearchPathRev("resources/sounds/");
for (auto & folder : searchPath)
{
if (QFile::exists(folder + "res.xml"))
Expand Down Expand Up @@ -552,7 +552,7 @@ bool AudioManager::tryAddMusic(QString file, qint64 startPointMs, qint64 endPoin
#ifdef AUDIOSUPPORT
if (!m_noAudio)
{
QString currentPath = Vfs::find(file);
QString currentPath = VirtualPaths::find(file);
if (QFile::exists(currentPath))
{
m_player->m_player.stop();
Expand Down Expand Up @@ -633,7 +633,7 @@ void AudioManager::SlotLoadFolder(QString folder)
{
#ifdef AUDIOSUPPORT
QStringList loadedSounds;
QStringList searchPath = Vfs::createSearchPathRev(folder);
QStringList searchPath = VirtualPaths::createSearchPathRev(folder);
for (QString folder : searchPath)
{
loadMusicFolder(folder, loadedSounds);
Expand Down
4 changes: 2 additions & 2 deletions coreengine/globalutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "coreengine/gameconsole.h"
#include "coreengine/interpreter.h"
#include "coreengine/settings.h"
#include "coreengine/vfs.h"
#include "coreengine/virtualpaths.h"

#include "game/gamemap.h"

Expand Down Expand Up @@ -335,7 +335,7 @@ QStringList GlobalUtils::getFiles(const QString folder, const QStringList filter
{
QStringList ret;

QStringList paths = Vfs::createSearchPath("", false);
QStringList paths = VirtualPaths::createSearchPath("", false);
for (const auto & path : std::as_const(paths))
{
QDirIterator dirIter(path + folder, filter, QDir::Files, QDirIterator::Subdirectories);
Expand Down
22 changes: 11 additions & 11 deletions coreengine/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "coreengine/audiomanager.h"
#include "coreengine/Gamepad.h"
#include "coreengine/interpreter.h"
#include "coreengine/vfs.h"
#include "coreengine/virtualpaths.h"

const char* const Settings::DEFAULT_AUDIODEVICE = "@@default@@";

Expand Down Expand Up @@ -630,7 +630,7 @@ void Settings::setUserPath(const QString newUserPath)
}
m_userPath = folder;
}
Vfs::setSearchPath(m_userPath, m_activeMods);
VirtualPaths::setSearchPath(m_userPath, m_activeMods);
}

bool Settings::getSmallScreenDevice()
Expand Down Expand Up @@ -1044,7 +1044,7 @@ void Settings::setActiveMods(const QStringList activeMods)
qint32 i = 0;
while (i < m_activeMods.size())
{
QDir dir(Vfs::find(m_activeMods[i], false));
QDir dir(VirtualPaths::find(m_activeMods[i], false));
if (!dir.exists())
{
CONSOLE_PRINT("Removing mod from active list: " + m_activeMods[i] + " because it wasn't found.", GameConsole::eWARNING);
Expand All @@ -1060,7 +1060,7 @@ void Settings::setActiveMods(const QStringList activeMods)
{
CONSOLE_PRINT("Loaded mod: " + mod, GameConsole::eDEBUG);
bool found = false;
QFile file(Vfs::find(mod + "/mod.txt", false));
QFile file(VirtualPaths::find(mod + "/mod.txt", false));
if (file.exists())
{
file.open(QFile::ReadOnly);
Expand All @@ -1081,7 +1081,7 @@ void Settings::setActiveMods(const QStringList activeMods)
m_activeModVersions.append("1.0.0");
}
}
Vfs::setSearchPath(m_userPath, m_activeMods);
VirtualPaths::setSearchPath(m_userPath, m_activeMods);
}

bool Settings::getShowIngameCoordinates()
Expand Down Expand Up @@ -2004,7 +2004,7 @@ void Settings::getModInfos(QString mod, QString & name, QString & description, Q
QStringList & tags, QString & thumbnail)
{
name = mod;
QFile file(Vfs::find(mod + "/mod.txt", false));
QFile file(VirtualPaths::find(mod + "/mod.txt", false));
isCosmetic = false;
if (file.exists())
{
Expand Down Expand Up @@ -2060,7 +2060,7 @@ void Settings::getModInfos(QString mod, QString & name, QString & description, Q
QStringList Settings::getAvailableMods()
{
QFileInfoList infoList;
auto searchPath = Vfs::findAllRev("mods", false);
auto searchPath = VirtualPaths::findAllRev("mods", false);
for (const auto & entry : searchPath)
{
if (QFile::exists(entry))
Expand Down Expand Up @@ -2222,7 +2222,7 @@ void Settings::setLanguage(const QString language)
m_translators.clear();
m_language = language;

QStringList searchPaths = Vfs::findAll("resources/translation/lang_" + m_language + ".qm");
QStringList searchPaths = VirtualPaths::findAll("resources/translation/lang_" + m_language + ".qm");
for (const auto & file : searchPaths)
{
auto translator = MemoryManagement::createNamedQObject<QTranslator>("QTranslator");
Expand All @@ -2243,7 +2243,7 @@ QStringList Settings::getLanguageNames()
{
QLocale english("en");
QStringList items = {english.nativeLanguageName()};
QStringList paths = Vfs::createSearchPath("resources/translation/");
QStringList paths = VirtualPaths::createSearchPath("resources/translation/");
QStringList filter;
filter << "*.qm";
for (const QString & path : std::as_const(paths))
Expand All @@ -2266,7 +2266,7 @@ QStringList Settings::getLanguageNames()
QStringList Settings::getLanguageIds()
{
QStringList languages = {"en"};
QStringList paths = Vfs::createSearchPath("resources/translation/");
QStringList paths = VirtualPaths::createSearchPath("resources/translation/");
QStringList filter;
filter << "*.qm";
for (const QString & path : std::as_const(paths))
Expand All @@ -2288,7 +2288,7 @@ QStringList Settings::getLanguageIds()
qint32 Settings::getCurrentLanguageIndex()
{
qint32 current = 0;
QStringList paths = Vfs::createSearchPath("resources/translation/");
QStringList paths = VirtualPaths::createSearchPath("resources/translation/");
QStringList filter;
filter << "*.qm";
qint32 i = 0;
Expand Down
16 changes: 8 additions & 8 deletions coreengine/vfs.cpp → coreengine/virtualpaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <QList>
#include <QSet>

#include "coreengine/vfs.h"
#include "coreengine/virtualpaths.h"

const QStringList Vfs::emptyList;
const QStringList VirtualPaths::emptyList;

struct SearchPath final
{
Expand All @@ -15,7 +15,7 @@ struct SearchPath final
};
static QList<SearchPath> searchPath;

void Vfs::setSearchPath(const QString& userPath, const QStringList& mods)
void VirtualPaths::setSearchPath(const QString& userPath, const QStringList& mods)
{
CONSOLE_PRINT("Initializing VFS...", GameConsole::eINFO);

Expand Down Expand Up @@ -89,7 +89,7 @@ static ProcessedName processName(const QString& pName)
}
}

QString Vfs::find(const QString& pName, bool checkMods) {
QString VirtualPaths::find(const QString& pName, bool checkMods) {
auto name = processName(pName);

QString newPath;
Expand Down Expand Up @@ -119,7 +119,7 @@ QString Vfs::find(const QString& pName, bool checkMods) {
return ":/this_should_not_exist" + name.path;
}

QStringList Vfs::createSearchPathInternal(const QString& pName, bool checkMods, bool firstPriority)
QStringList VirtualPaths::createSearchPathInternal(const QString& pName, bool checkMods, bool firstPriority)
{
auto name = processName(pName);

Expand Down Expand Up @@ -149,7 +149,7 @@ QStringList Vfs::createSearchPathInternal(const QString& pName, bool checkMods,
return list;
}

QStringList Vfs::findAllInternal(const QString& pName, bool checkMods, bool firstPriority)
QStringList VirtualPaths::findAllInternal(const QString& pName, bool checkMods, bool firstPriority)
{
auto name = processName(pName);

Expand Down Expand Up @@ -185,12 +185,12 @@ QStringList Vfs::findAllInternal(const QString& pName, bool checkMods, bool firs
return list;
}

QFileInfoList Vfs::list(const QString& name, const QStringList& filters, bool checkMods)
QFileInfoList VirtualPaths::list(const QString& name, const QStringList& filters, bool checkMods)
{
QSet<QString> foundBaseNames;
QFileInfoList infoList;

for (auto & path : Vfs::createSearchPathRev(name, checkMods))
for (auto & path : VirtualPaths::createSearchPathRev(name, checkMods))
{
QFileInfo pathInfo(path);
if (pathInfo.exists() && pathInfo.isDir())
Expand Down
6 changes: 3 additions & 3 deletions coreengine/vfs.h → coreengine/virtualpaths.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <QStringList>
#include <QFileInfoList>

class Vfs final
class VirtualPaths final
{
public:

Expand Down Expand Up @@ -51,8 +51,8 @@ class Vfs final

private:

Vfs() = delete;
~Vfs() = delete;
VirtualPaths() = delete;
~VirtualPaths() = delete;

static QStringList createSearchPathInternal(const QString& name, bool checkMods = true, bool firstPriority = false);
static QStringList findAllInternal(const QString& name, bool checkMods = true, bool firstPriority = false);
Expand Down
4 changes: 2 additions & 2 deletions coreengine/workerthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "coreengine/workerthread.h"
#include "coreengine/gameconsole.h"
#include "coreengine/userdata.h"
#include "coreengine/vfs.h"
#include "coreengine/virtualpaths.h"

#include "menue/mainwindow.h"

Expand Down Expand Up @@ -127,7 +127,7 @@ void WorkerThread::start()
pConsole->init();
UiFactory::getInstance();
// load General-Base Scripts
QStringList searchPaths = Vfs::createSearchPath("resources/scripts/general");
QStringList searchPaths = VirtualPaths::createSearchPath("resources/scripts/general");
for (auto & path : searchPaths)
{
QStringList filter;
Expand Down
6 changes: 3 additions & 3 deletions game/campaign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "coreengine/gameconsole.h"
#include "coreengine/settings.h"
#include "coreengine/mainapp.h"
#include "coreengine/vfs.h"
#include "coreengine/virtualpaths.h"

const char* const Campaign::scriptName = "campaignScript";

Expand Down Expand Up @@ -72,15 +72,15 @@ Campaign::CampaignMapInfo Campaign::getCampaignMaps()
files.removeAt(0);
for (qint32 i = 0; i < files.size(); ++i)
{
QString path = Vfs::find(folder + files[i]);
QString path = VirtualPaths::find(folder + files[i]);
if (QFile::exists(path))
{
files[i] = path;
CONSOLE_PRINT("adding campaign map: " + path, GameConsole::eDEBUG);
}
}

QStringList searchPath = Vfs::createSearchPath(folder, false);
QStringList searchPath = VirtualPaths::createSearchPath(folder, false);
for (qint32 i = 0; i < searchPath.size(); i++)
{
addDeveloperMaps(searchPath[i], files);
Expand Down
4 changes: 2 additions & 2 deletions game/gameanimation/gameanimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "coreengine/interpreter.h"
#include "coreengine/settings.h"
#include "coreengine/audiomanager.h"
#include "coreengine/vfs.h"
#include "coreengine/virtualpaths.h"

GameAnimation::GameAnimation(quint32 frameTime, GameMap* pMap)
: m_frameTime(frameTime / Settings::getInstance()->getAnimationSpeed()),
Expand Down Expand Up @@ -252,7 +252,7 @@ void GameAnimation::addSprite3(QString spriteID, float offsetX, float offsetY, Q
else
{
QImage img;
QString imgPath = Vfs::find(spriteID);
QString imgPath = VirtualPaths::find(spriteID);
if (QFile::exists(imgPath))
{
img = QImage(imgPath);
Expand Down
4 changes: 2 additions & 2 deletions game/gameanimation/gameanimationcapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "coreengine/gameconsole.h"
#include "coreengine/audiomanager.h"
#include "coreengine/interpreter.h"
#include "coreengine/vfs.h"
#include "coreengine/virtualpaths.h"

#include "spritingsupport/spritecreator.h"

Expand Down Expand Up @@ -48,7 +48,7 @@ void GameAnimationCapture::addBuildingSprite(const QString spriteID, Player* sta
m_buildingResAnim = MemoryManagement::create<oxygine::SingleResAnim>();
m_captureBuildingResAnim = MemoryManagement::create<oxygine::SingleResAnim>();
}
QString path = Vfs::find(pAnim->getResPath());
QString path = VirtualPaths::find(pAnim->getResPath());
if (QFile::exists(path))
{
QImage preCaptureImage(path);
Expand Down
4 changes: 2 additions & 2 deletions game/gameanimation/gameanimationdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "coreengine/interpreter.h"
#include "coreengine/audiomanager.h"
#include "coreengine/vfs.h"
#include "coreengine/virtualpaths.h"

#include "resource_management/gamemanager.h"
#include "resource_management/fontmanager.h"
Expand Down Expand Up @@ -351,7 +351,7 @@ void GameAnimationDialog::loadBackground(const QString file)
if (!file.isEmpty())
{
QImage img;
QString imgPath = Vfs::find(file);
QString imgPath = VirtualPaths::find(file);
if (QFile::exists(imgPath))
{
img = QImage(imgPath);
Expand Down
Loading

0 comments on commit 55ef6a7

Please sign in to comment.