diff --git a/src/fileio.cpp b/src/fileio.cpp --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -1253,7 +1253,7 @@ uint FileScanner::Scan(const char *exten * @return the number of found files, i.e. the number of times that * AddFile returned true. */ -uint FileScanner::Scan(const char *extension, const char *directory, bool recursive) +uint FileScanner::Scan(const char *extension, const std::string &directory, bool recursive) { std::string path(directory); AppendPathSeparator(path); diff --git a/src/fileio_func.h b/src/fileio_func.h --- a/src/fileio_func.h +++ b/src/fileio_func.h @@ -42,7 +42,7 @@ public: virtual ~FileScanner() {} uint Scan(const char *extension, Subdirectory sd, bool tars = true, bool recursive = true); - uint Scan(const char *extension, const char *directory, bool recursive = true); + uint Scan(const char *extension, const std::string &directory, bool recursive = true); /** * Add a file with the given filename. diff --git a/src/fios.cpp b/src/fios.cpp --- a/src/fios.cpp +++ b/src/fios.cpp @@ -410,7 +410,7 @@ static void FiosGetFileList(SaveLoadOper /* Show files */ FiosFileScanner scanner(fop, callback_proc, file_list); if (subdir == NO_DIRECTORY) { - scanner.Scan(nullptr, _fios_path->c_str(), false); + scanner.Scan(nullptr, *_fios_path, false); } else { scanner.Scan(nullptr, subdir, true, true); } diff --git a/src/script/script_scanner.cpp b/src/script/script_scanner.cpp --- a/src/script/script_scanner.cpp +++ b/src/script/script_scanner.cpp @@ -28,7 +28,7 @@ bool ScriptScanner::AddFile(const std::s this->main_script = filename; this->tar_file = tar_filename; - auto p = this->main_script.rfind(PATHSEPCHAR); + auto p = this->main_script.find_last_of(PATHSEPCHAR); this->main_script.erase(p != std::string::npos ? p + 1 : 0); this->main_script += "main.nut"; @@ -229,12 +229,11 @@ static bool IsSameScript(const ContentIn checksum.AddFile(tar.first, 0, tar_filename); } } else { - char path[MAX_PATH]; - strecpy(path, info->GetMainScript(), lastof(path)); /* There'll always be at least 1 path separator character in a script * main script name as the search algorithm requires the main script to * be in a subdirectory of the script directory; so