summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util/corefile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util/corefile.cpp')
-rw-r--r--src/lib/util/corefile.cpp71
1 files changed, 0 insertions, 71 deletions
diff --git a/src/lib/util/corefile.cpp b/src/lib/util/corefile.cpp
index 6bb6a043a04..4fed0e0a28b 100644
--- a/src/lib/util/corefile.cpp
+++ b/src/lib/util/corefile.cpp
@@ -12,13 +12,10 @@
#include "coretmpl.h"
#include "osdcore.h"
-#include "path.h"
#include "unicode.h"
#include "vecstream.h"
-#include <algorithm>
#include <cassert>
-#include <cctype>
#include <cstring>
#include <iterator>
#include <limits>
@@ -1057,71 +1054,3 @@ std::error_condition core_file::load(std::string_view filename, std::vector<uint
}
} // namespace util
-
-
-
-/***************************************************************************
- FILENAME UTILITIES
-***************************************************************************/
-
-// -------------------------------------------------
-// core_filename_extract_base - extract the base
-// name from a filename; note that this makes
-// assumptions about path separators
-// -------------------------------------------------
-
-std::string_view core_filename_extract_base(std::string_view name, bool strip_extension) noexcept
-{
- // find the start of the basename
- auto const start = std::find_if(name.rbegin(), name.rend(), &util::is_directory_separator);
- if (start == name.rbegin())
- return std::string_view();
-
- // find the end of the basename
- auto const chop_position = strip_extension
- ? std::find(name.rbegin(), start, '.')
- : start;
- auto const end = ((chop_position != start) && (std::next(chop_position) != start))
- ? std::next(chop_position)
- : name.rbegin();
-
- return std::string_view(&*start.base(), end.base() - start.base());
-}
-
-
-// -------------------------------------------------
-// core_filename_extract_extension
-// -------------------------------------------------
-
-std::string_view core_filename_extract_extension(std::string_view filename, bool strip_period) noexcept
-{
- auto loc = filename.find_last_of('.');
- if (loc != std::string_view::npos)
- return filename.substr(loc + (strip_period ? 1 : 0));
- else
- return std::string_view();
-}
-
-
-// -------------------------------------------------
-// core_filename_ends_with - does the given
-// filename end with the specified extension?
-// -------------------------------------------------
-
-bool core_filename_ends_with(std::string_view filename, std::string_view extension) noexcept
-{
- auto namelen = filename.length();
- auto extlen = extension.length();
-
- // first if the extension is bigger than the name, we definitely don't match
- bool matches = namelen >= extlen;
-
- // work backwards checking for a match
- while (matches && extlen > 0 && namelen > 0)
- {
- if (tolower((uint8_t)filename[--namelen]) != tolower((uint8_t)extension[--extlen]))
- matches = false;
- }
-
- return matches;
-}