From 1900125c98136e1eeb1ec39698a1f5185d5531f7 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 4 May 2025 19:01:17 +0200 Subject: [PATCH] Codechange: Use string_view for FileExists. --- src/fileio.cpp | 2 +- src/fileio_func.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fileio.cpp b/src/fileio.cpp index b59de557b3..bae969a362 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -129,7 +129,7 @@ bool FioCheckFileExists(std::string_view filename, Subdirectory subdir) * @param filename the file to test. * @return true if and only if the file exists. */ -bool FileExists(const std::string &filename) +bool FileExists(std::string_view filename) { std::error_code ec; return std::filesystem::exists(OTTD2FS(filename), ec); diff --git a/src/fileio_func.h b/src/fileio_func.h index 79ab20ca56..36776ed992 100644 --- a/src/fileio_func.h +++ b/src/fileio_func.h @@ -27,7 +27,7 @@ void SanitizeFilename(std::string &filename); void AppendPathSeparator(std::string &buf); void DeterminePaths(std::string_view exe, bool only_local_path); std::unique_ptr ReadFileToMem(const std::string &filename, size_t &lenp, size_t maxsize); -bool FileExists(const std::string &filename); +bool FileExists(std::string_view filename); bool ExtractTar(const std::string &tar_filename, Subdirectory subdir); extern std::string _personal_dir; ///< custom directory for personal settings, saves, newgrf, etc.