From b67dc636e44b527a14f03a470a410be812648a86 Mon Sep 17 00:00:00 2001 From: Cheng Li <69489965+chengcli@users.noreply.github.com> Date: Sat, 17 Feb 2024 16:38:15 -0500 Subject: [PATCH] FindInputFile -> FindResource (#14) --- src/application.cpp | 12 ++++++------ src/application.hpp | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/application.cpp b/src/application.cpp index 82324ea..b2de2b5 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -210,7 +210,7 @@ void Application::setDefaultDirectories() { input_dirs_.push_back(s.substr(start, end)); } -void Application::AddDataDirectory(const std::string& dir) { +void Application::AddResourceDirectory(const std::string& dir) { std::unique_lock dirLock(dir_mutex); if (input_dirs_.empty()) { setDefaultDirectories(); @@ -238,7 +238,7 @@ void Application::AddDataDirectory(const std::string& dir) { input_dirs_.insert(input_dirs_.begin(), d); } -std::string Application::FindInputFile(const std::string& name) { +std::string Application::FindResource(const std::string& name) { std::unique_lock dirLock(dir_mutex); std::string::size_type islash = name.find('/'); std::string::size_type ibslash = name.find('\\'); @@ -257,7 +257,7 @@ std::string Application::FindInputFile(const std::string& name) { if (fin) { return full_name; } else { - throw NotFoundError("FindInputFile", "Input file " + name); + throw NotFoundError("FindResource", "Resource " + name); } } } @@ -269,7 +269,7 @@ std::string Application::FindInputFile(const std::string& name) { if (fin) { return name; } else { - throw NotFoundError("FindInputFile", "Input file " + name); + throw NotFoundError("FindResource", "Resource " + name); } } @@ -283,7 +283,7 @@ std::string Application::FindInputFile(const std::string& name) { return full_name; } } - std::string msg = "\nInput file " + name + " not found in director"; + std::string msg = "\nResource " + name + " not found in director"; msg += (nd_ == 1 ? "y " : "ies "); for (size_t i = 0; i < nd_; i++) { msg += "\n'" + dirs[i] + "'"; @@ -298,7 +298,7 @@ std::string Application::FindInputFile(const std::string& name) { throw NotFoundError(msg); } -std::string Application::GetDataDirectories(const std::string& sep) { +std::string Application::GetResourceDirectories(const std::string& sep) { std::stringstream ss; for (size_t i = 0; i < input_dirs_.size(); ++i) { if (i != 0) { diff --git a/src/application.hpp b/src/application.hpp index 9e7e5ce..4bc9de4 100644 --- a/src/application.hpp +++ b/src/application.hpp @@ -69,13 +69,13 @@ class Application { //! Add a directory to the data file search path. /*! - * @ingroup inputfiles + * @ingroup resource * * @param dir String name for the directory to be added to the search path */ - void AddDataDirectory(const std::string& dir); + void AddResourceDirectory(const std::string& dir); - //! Find an input file. + //! Find a resource file. /*! * This routine will search for a file in the default locations specified * for the application. See the routine setDefaultDirectories() listed @@ -94,9 +94,9 @@ class Application { * * If the file is not found an exception is thrown. * - * @ingroup inputfiles + * @ingroup resource */ - std::string FindInputFile(const std::string& name); + std::string FindResource(const std::string& name); //! Get the data directories /*! @@ -106,9 +106,9 @@ class Application { * @param sep Separator to use between directories in the string * @return A string of directories separated by the input sep * - * @ingroup inputfiles + * @ingroup resource */ - std::string GetDataDirectories(const std::string& sep); + std::string GetResourceDirectories(const std::string& sep); //! Set the versions of Python to try when loading user-defined extensions, //! in order of preference. Separate multiple versions with commas, for