Skip to content

Commit

Permalink
Disable warning on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Idhrendur committed Jan 12, 2025
1 parent 06e9e02 commit 93dcb52
Show file tree
Hide file tree
Showing 19 changed files with 261 additions and 2 deletions.
9 changes: 9 additions & 0 deletions CommonFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,25 @@ std::string trimPath(const std::string& fileName)
std::string getPath(const std::string& fileName)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
const auto rawFile = trimPath(fileName);
#pragma warning(pop)
#pragma GCC diagnostic pop
const auto filePos = fileName.find(rawFile);
return fileName.substr(0, filePos);
}

std::string trimExtension(const std::string& fileName)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
const auto rawFile = trimPath(fileName);
#pragma warning(pop)
#pragma GCC diagnostic pop
const auto dotPos = rawFile.find_last_of('.');
if (dotPos == std::string::npos)
{
Expand All @@ -42,9 +48,12 @@ std::string trimExtension(const std::string& fileName)
std::string getExtension(const std::string& fileName)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
const auto rawFile = trimPath(fileName);
#pragma warning(pop)
#pragma GCC diagnostic pop
const auto dotPos = rawFile.find_last_of('.');
if (dotPos == std::string::npos)
{
Expand Down
3 changes: 3 additions & 0 deletions ConverterVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ void commonItems::ConverterVersion::loadVersion(const path& filename)
void commonItems::ConverterVersion::loadVersion(const std::string& filename)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
loadVersion(u8path(filename));
#pragma warning(pop)
#pragma GCC diagnostic pop
}


Expand Down
12 changes: 12 additions & 0 deletions GameVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,12 @@ std::optional<GameVersion> GameVersion::extractVersionFromLauncher(const path& f
std::optional<GameVersion> GameVersion::extractVersionFromLauncher(const std::string& filePath)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return extractVersionFromLauncher(u8path(filePath));
#pragma warning(pop)
#pragma GCC diagnostic pop
}


Expand Down Expand Up @@ -473,9 +476,12 @@ std::optional<GameVersion> GameVersion::extractVersionByStringFromLauncher(const
std::optional<GameVersion> GameVersion::extractVersionByStringFromLauncher(const std::string& versionString, const std::string& filePath)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return extractVersionByStringFromLauncher(versionString, u8path(filePath));
#pragma warning(pop)
#pragma GCC diagnostic pop
}


Expand Down Expand Up @@ -533,9 +539,12 @@ std::optional<GameVersion> GameVersion::extractVersionFromReadMe(const path& fil
std::optional<GameVersion> GameVersion::extractVersionFromReadMe(const std::string& filePath)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return extractVersionFromReadMe(u8path(filePath));
#pragma warning(pop)
#pragma GCC diagnostic pop
}


Expand Down Expand Up @@ -600,7 +609,10 @@ std::optional<GameVersion> GameVersion::extractVersionFromChangeLog(const path&
std::optional<GameVersion> GameVersion::extractVersionFromChangeLog(const std::string& filePath)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return extractVersionFromChangeLog(u8path(filePath));
#pragma warning(pop)
#pragma GCC diagnostic pop
}
3 changes: 3 additions & 0 deletions Localization/LocalizationDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ void commonItems::LocalizationDatabase::ScrapeLocalizations(const ModFilesystem&
void commonItems::LocalizationDatabase::ScrapeLocalizations(const ModFilesystem& mod_filesystem, const std::string& localization_folder)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
commonItems::LocalizationDatabase::ScrapeLocalizations(mod_filesystem, u8path(localization_folder));
#pragma warning(pop)
#pragma GCC diagnostic pop
}


Expand Down
3 changes: 3 additions & 0 deletions ModLoader/ModFilesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ class ModFilesystem
// replace_paths will block earlier mods and the game It is the caller's responsibility to sort the mods appropriately
explicit ModFilesystem(std::filesystem::path game_root, std::vector<Mod> mods): game_root_(game_root), mods_(std::move(mods)) {}
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
[[deprecated("Use the std::filesystem::path version")]] explicit ModFilesystem(std::string_view game_root, std::vector<Mod> mods):
game_root_(std::filesystem::u8path(game_root)), mods_(std::move(mods))
{
}
#pragma warning(pop)
#pragma GCC diagnostic pop

// lookup functions
[[nodiscard]] std::optional<std::filesystem::path> GetActualFileLocation(const std::filesystem::path& path) const;
Expand Down
9 changes: 9 additions & 0 deletions ModLoader/ModLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ void commonItems::ModLoader::loadMods(const path& gameDocumentsPath, const Mods&
void commonItems::ModLoader::loadMods(const std::string& gameDocumentsPath, const Mods& incomingMods)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
loadMods(std::vector<std::string>{gameDocumentsPath + "/mod"}, incomingMods);
#pragma warning(pop)
#pragma GCC diagnostic pop
}


Expand Down Expand Up @@ -96,7 +99,9 @@ void commonItems::ModLoader::loadMods(const std::vector<path>& gameModPaths, con
void commonItems::ModLoader::loadMods(const std::vector<std::string>& gameModPaths, const Mods& incomingMods)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
if (gameModPaths.empty())
{
Log(LogLevel::Info) << "No mod directories were provided. Skipping mod processing.";
Expand Down Expand Up @@ -151,6 +156,7 @@ void commonItems::ModLoader::loadMods(const std::vector<std::string>& gameModPat
usableMods.emplace_back(Mod(mod.name, possibleModPath->string() + "/", mod.dependencies, mod.replacedFolders));
}
#pragma warning(pop)
#pragma GCC diagnostic pop
}


Expand Down Expand Up @@ -264,7 +270,9 @@ void commonItems::ModLoader::loadModDirectories(const std::vector<path>& gameMod
void commonItems::ModLoader::loadModDirectories(const std::vector<std::string>& gameModPaths, const Mods& incomingMods)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
std::set<std::string> diskModNames;
for (const auto& modPath: gameModPaths)
{
Expand Down Expand Up @@ -365,6 +373,7 @@ void commonItems::ModLoader::loadModDirectories(const std::vector<std::string>&
}
}
#pragma warning(pop)
#pragma GCC diagnostic pop
}


Expand Down
9 changes: 9 additions & 0 deletions ModLoader/ModParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ void commonItems::ModParser::parseMod(const path& fileName)
void commonItems::ModParser::parseMod(const std::string& fileName)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
parseMod(u8path(fileName));
#pragma warning(pop)
#pragma GCC diagnostic pop
}


Expand Down Expand Up @@ -116,9 +119,12 @@ void commonItems::ModParser::parseMetadata(const path& metadata_path)
void commonItems::ModParser::parseMetadata(const std::string& fileName)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
parseMetadata(u8path(fileName));
#pragma warning(pop)
#pragma GCC diagnostic pop
}


Expand All @@ -137,7 +143,10 @@ const std::set<std::string> commonItems::ModParser::getReplacedPaths() const
void commonItems::ModParser::setPath(const std::string& path)
{
#pragma warning(push)
#pragma GCC diagnostic push
#pragma warning(disable : 4996)
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
path_ = u8path(path).make_preferred();
#pragma warning(pop)
#pragma GCC diagnostic pop
}
Loading

0 comments on commit 93dcb52

Please sign in to comment.