diff options
| author | 2015-02-18 22:37:01 -0800 | |
|---|---|---|
| committer | 2015-02-18 23:23:18 -0800 | |
| commit | 49f94b82b4a9431c0db7327038695790bafdfd31 (patch) | |
| tree | 07254c1b634a8b883d1306583344680e83701f6c /src/common | |
| parent | Remove redundant utf8 compilation unit that was leftover from Dolphin (diff) | |
| download | yuzu-49f94b82b4a9431c0db7327038695790bafdfd31.tar.gz yuzu-49f94b82b4a9431c0db7327038695790bafdfd31.tar.xz yuzu-49f94b82b4a9431c0db7327038695790bafdfd31.zip | |
Remove "super lame/broken" file_search compilation unit that was leftover from Dolphin
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/common/file_search.cpp | 103 | ||||
| -rw-r--r-- | src/common/file_search.h | 23 |
3 files changed, 0 insertions, 128 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index e12699c23..b05c35546 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -4,7 +4,6 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in" "${CMAKE_CURRENT_SOU | |||
| 4 | set(SRCS | 4 | set(SRCS |
| 5 | break_points.cpp | 5 | break_points.cpp |
| 6 | emu_window.cpp | 6 | emu_window.cpp |
| 7 | file_search.cpp | ||
| 8 | file_util.cpp | 7 | file_util.cpp |
| 9 | hash.cpp | 8 | hash.cpp |
| 10 | key_map.cpp | 9 | key_map.cpp |
| @@ -36,7 +35,6 @@ set(HEADERS | |||
| 36 | debug_interface.h | 35 | debug_interface.h |
| 37 | emu_window.h | 36 | emu_window.h |
| 38 | fifo_queue.h | 37 | fifo_queue.h |
| 39 | file_search.h | ||
| 40 | file_util.h | 38 | file_util.h |
| 41 | hash.h | 39 | hash.h |
| 42 | key_map.h | 40 | key_map.h |
diff --git a/src/common/file_search.cpp b/src/common/file_search.cpp deleted file mode 100644 index b3a0a84fb..000000000 --- a/src/common/file_search.cpp +++ /dev/null | |||
| @@ -1,103 +0,0 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | |||
| 6 | #include "common/common.h" | ||
| 7 | |||
| 8 | #ifndef _WIN32 | ||
| 9 | #include <dirent.h> | ||
| 10 | #else | ||
| 11 | #include <windows.h> | ||
| 12 | #endif | ||
| 13 | |||
| 14 | #include <algorithm> | ||
| 15 | |||
| 16 | #include "common/file_search.h" | ||
| 17 | #include "common/string_util.h" | ||
| 18 | |||
| 19 | |||
| 20 | CFileSearch::CFileSearch(const CFileSearch::XStringVector& _rSearchStrings, const CFileSearch::XStringVector& _rDirectories) | ||
| 21 | { | ||
| 22 | // Reverse the loop order for speed? | ||
| 23 | for (size_t j = 0; j < _rSearchStrings.size(); j++) | ||
| 24 | { | ||
| 25 | for (size_t i = 0; i < _rDirectories.size(); i++) | ||
| 26 | { | ||
| 27 | FindFiles(_rSearchStrings[j], _rDirectories[i]); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | |||
| 33 | void CFileSearch::FindFiles(const std::string& _searchString, const std::string& _strPath) | ||
| 34 | { | ||
| 35 | std::string GCMSearchPath; | ||
| 36 | Common::BuildCompleteFilename(GCMSearchPath, _strPath, _searchString); | ||
| 37 | #ifdef _WIN32 | ||
| 38 | WIN32_FIND_DATA findData; | ||
| 39 | HANDLE FindFirst = FindFirstFile(Common::UTF8ToTStr(GCMSearchPath).c_str(), &findData); | ||
| 40 | |||
| 41 | if (FindFirst != INVALID_HANDLE_VALUE) | ||
| 42 | { | ||
| 43 | bool bkeepLooping = true; | ||
| 44 | |||
| 45 | while (bkeepLooping) | ||
| 46 | { | ||
| 47 | if (findData.cFileName[0] != '.') | ||
| 48 | { | ||
| 49 | std::string strFilename; | ||
| 50 | Common::BuildCompleteFilename(strFilename, _strPath, Common::TStrToUTF8(findData.cFileName)); | ||
| 51 | m_FileNames.push_back(strFilename); | ||
| 52 | } | ||
| 53 | |||
| 54 | bkeepLooping = FindNextFile(FindFirst, &findData) ? true : false; | ||
| 55 | } | ||
| 56 | } | ||
| 57 | FindClose(FindFirst); | ||
| 58 | |||
| 59 | |||
| 60 | #else | ||
| 61 | // TODO: super lame/broken | ||
| 62 | |||
| 63 | auto end_match(_searchString); | ||
| 64 | |||
| 65 | // assuming we have a "*.blah"-like pattern | ||
| 66 | if (!end_match.empty() && end_match[0] == '*') | ||
| 67 | end_match.erase(0, 1); | ||
| 68 | |||
| 69 | // ugly | ||
| 70 | if (end_match == ".*") | ||
| 71 | end_match.clear(); | ||
| 72 | |||
| 73 | DIR* dir = opendir(_strPath.c_str()); | ||
| 74 | |||
| 75 | if (!dir) | ||
| 76 | return; | ||
| 77 | |||
| 78 | while (auto const dp = readdir(dir)) | ||
| 79 | { | ||
| 80 | std::string found(dp->d_name); | ||
| 81 | |||
| 82 | if ((found != ".") && (found != "..") | ||
| 83 | && (found.size() >= end_match.size()) | ||
| 84 | && std::equal(end_match.rbegin(), end_match.rend(), found.rbegin())) | ||
| 85 | { | ||
| 86 | std::string full_name; | ||
| 87 | if (_strPath.c_str()[_strPath.size()-1] == DIR_SEP_CHR) | ||
| 88 | full_name = _strPath + found; | ||
| 89 | else | ||
| 90 | full_name = _strPath + DIR_SEP + found; | ||
| 91 | |||
| 92 | m_FileNames.push_back(full_name); | ||
| 93 | } | ||
| 94 | } | ||
| 95 | |||
| 96 | closedir(dir); | ||
| 97 | #endif | ||
| 98 | } | ||
| 99 | |||
| 100 | const CFileSearch::XStringVector& CFileSearch::GetFileNames() const | ||
| 101 | { | ||
| 102 | return m_FileNames; | ||
| 103 | } | ||
diff --git a/src/common/file_search.h b/src/common/file_search.h deleted file mode 100644 index 55ca02638..000000000 --- a/src/common/file_search.h +++ /dev/null | |||
| @@ -1,23 +0,0 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <string> | ||
| 8 | #include <vector> | ||
| 9 | |||
| 10 | class CFileSearch | ||
| 11 | { | ||
| 12 | public: | ||
| 13 | typedef std::vector<std::string>XStringVector; | ||
| 14 | |||
| 15 | CFileSearch(const XStringVector& _rSearchStrings, const XStringVector& _rDirectories); | ||
| 16 | const XStringVector& GetFileNames() const; | ||
| 17 | |||
| 18 | private: | ||
| 19 | |||
| 20 | void FindFiles(const std::string& _searchString, const std::string& _strPath); | ||
| 21 | |||
| 22 | XStringVector m_FileNames; | ||
| 23 | }; | ||