Skip to content

Commit

Permalink
FindInputFile -> FindResource (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
chengcli authored Feb 17, 2024
1 parent af1519a commit b67dc63
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::mutex> dirLock(dir_mutex);
if (input_dirs_.empty()) {
setDefaultDirectories();
Expand Down Expand Up @@ -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<std::mutex> dirLock(dir_mutex);
std::string::size_type islash = name.find('/');
std::string::size_type ibslash = name.find('\\');
Expand All @@ -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);
}
}
}
Expand All @@ -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);
}
}

Expand All @@ -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] + "'";
Expand All @@ -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) {
Expand Down
14 changes: 7 additions & 7 deletions src/application.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
/*!
Expand All @@ -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
Expand Down

0 comments on commit b67dc63

Please sign in to comment.