Skip to content
Snippets Groups Projects
Commit c6f8ebcd authored by Bernd Hentschel's avatar Bernd Hentschel
Browse files

remove redundant code (file exists test)

parent 7c4d7b3b
Branches
No related tags found
1 merge request!137Feature/#448 resource search path
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "boost/filesystem.hpp"
#include "phx/resources/resource_manager.hpp" #include "phx/resources/resource_manager.hpp"
#include "phx/resources_path.hpp" #include "phx/resources_path.hpp"
...@@ -81,14 +83,9 @@ std::string ResourceUtils::ExtractFileExtension(const std::string& file_name) { ...@@ -81,14 +83,9 @@ std::string ResourceUtils::ExtractFileExtension(const std::string& file_name) {
std::string ResourceUtils::FindFileInSearchPath(const std::string& file_name) { std::string ResourceUtils::FindFileInSearchPath(const std::string& file_name) {
for (auto& entry : resource_search_paths_) { for (auto& entry : resource_search_paths_) {
auto full_name = entry + file_name; auto full_name = entry + file_name;
if (FileExists(full_name)) return full_name; if (boost::filesystem::exists(full_name.c_str())) return full_name;
} }
return ""; return "";
} }
bool ResourceUtils::FileExists(const std::string& full_file_name) {
std::fstream target_file(full_file_name.c_str());
return target_file.is_open();
}
} // namespace phx } // namespace phx
...@@ -72,7 +72,6 @@ class PHOENIX_EXPORT ResourceUtils final { ...@@ -72,7 +72,6 @@ class PHOENIX_EXPORT ResourceUtils final {
private: private:
static std::string FindFileInSearchPath(const std::string& file_name); static std::string FindFileInSearchPath(const std::string& file_name);
static bool FileExists(const std::string& full_file_name);
static std::vector<std::string> resource_search_paths_; static std::vector<std::string> resource_search_paths_;
}; };
......
  • Jan Delember @delember

    mentioned in merge request !140 (merged)

    By Bernd Hentschel on 2018-06-28T19:39:08 (imported from GitLab)

    ·

    mentioned in merge request !140 (merged)

    By Bernd Hentschel on 2018-06-28T19:39:08 (imported from GitLab)

    Toggle commit list
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment