mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-10-18 11:18:30 +00:00
Updated rom_checker.cpp to accomodate to Issac0-dev :)
This commit is contained in:
parent
97a2c28e4a
commit
9d83d9b9ff
1 changed files with 21 additions and 8 deletions
|
@ -1,7 +1,22 @@
|
|||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#ifndef __has_include
|
||||
static_assert(false, "This statement's not supported: __has_include")
|
||||
#else
|
||||
# if __cplusplus >= 201703L && __has_include(<filesystem>)
|
||||
# include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
# elif __has_include(<experimental/filesystem>)
|
||||
# include <experimental/filesystem>
|
||||
namespace fs = std::experimental::filesystem;
|
||||
# elif __has_include(<boost/filesystem.hpp>)
|
||||
# include <boost/filesystem.hpp>
|
||||
namespace fs = boost::filesystem
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
|
@ -18,8 +33,6 @@ extern "C" {
|
|||
#include "fs/fs.h"
|
||||
}
|
||||
|
||||
namespace fs = std::experimental::filesystem;
|
||||
|
||||
bool gRomIsValid = false;
|
||||
char gRomFilename[SYS_MAX_PATH] = "";
|
||||
|
||||
|
@ -64,10 +77,10 @@ static bool is_rom_valid(const std::string romPath) {
|
|||
std::string destPath = fs_get_write_path("") + std::string("baserom.") + md5->localizationName + ".z64";
|
||||
|
||||
// Copy the rom to the user path
|
||||
if (romPath != destPath && !std::experimental::filesystem::exists(std::experimental::filesystem::path(destPath))) {
|
||||
std::experimental::filesystem::copy_file(
|
||||
std::experimental::filesystem::path(romPath),
|
||||
std::experimental::filesystem::path(destPath)
|
||||
if (romPath != destPath && !fs::exists(fs::path(destPath))) {
|
||||
fs::copy_file(
|
||||
fs::path(romPath),
|
||||
fs::path(destPath)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -82,7 +95,7 @@ static bool is_rom_valid(const std::string romPath) {
|
|||
}
|
||||
|
||||
inline static bool scan_path_for_rom(const char *dir) {
|
||||
for (const auto &entry: std::experimental::filesystem::directory_iterator(dir)) {
|
||||
for (const auto &entry: fs::directory_iterator(dir)) {
|
||||
std::string path = entry.path().generic_string();
|
||||
if (str_ends_with(path.c_str(), ".z64")) {
|
||||
if (is_rom_valid(path)) { return true; }
|
||||
|
|
Loading…
Reference in a new issue