fs/StandardDirectory: use std::string_view instead of StringView
This commit is contained in:
parent
502e5f006a
commit
4964eda167
@ -24,8 +24,8 @@
|
||||
#include "StandardDirectory.hxx"
|
||||
#include "FileSystem.hxx"
|
||||
#include "XDG.hxx"
|
||||
#include "util/StringView.hxx"
|
||||
#include "config.h"
|
||||
#include "util/StringSplit.hxx"
|
||||
|
||||
#include <array>
|
||||
|
||||
@ -299,7 +299,7 @@ GetAppRuntimeDir() noexcept
|
||||
#ifdef __linux__
|
||||
/* systemd specific; see systemd.exec(5) */
|
||||
if (const char *runtime_directory = getenv("RUNTIME_DIRECTORY"))
|
||||
if (auto dir = StringView{runtime_directory}.Split(':').first;
|
||||
if (auto dir = Split(std::string_view{runtime_directory}, ':').first;
|
||||
!dir.empty())
|
||||
return AllocatedPath::FromFS(dir);
|
||||
#endif
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include "Traits.hxx"
|
||||
#include "util/StringCompare.hxx"
|
||||
#include "util/StringView.hxx"
|
||||
#include "util/UriExtract.hxx"
|
||||
|
||||
#include <string.h>
|
||||
@ -138,17 +137,15 @@ RelativePathImpl(typename Traits::string_view base,
|
||||
template<typename Traits>
|
||||
typename Traits::string_view
|
||||
RelativePathImpl(typename Traits::string_view base,
|
||||
typename Traits::string_view _other) noexcept
|
||||
typename Traits::string_view other) noexcept
|
||||
{
|
||||
BasicStringView<typename Traits::value_type> other(_other);
|
||||
|
||||
if (!other.SkipPrefix(base))
|
||||
if (!SkipPrefix(other, base))
|
||||
/* mismatch */
|
||||
return {};
|
||||
|
||||
if (!other.empty()) {
|
||||
if (!Traits::IsSeparator(other.front())) {
|
||||
if (!base.empty() && Traits::IsSeparator(other.data[-1]))
|
||||
if (!base.empty() && Traits::IsSeparator(other.data()[-1]))
|
||||
/* "other" has no more slash, but the
|
||||
matching base ended with a slash:
|
||||
enough to detect a match */
|
||||
@ -160,7 +157,7 @@ RelativePathImpl(typename Traits::string_view base,
|
||||
|
||||
/* skip remaining path separators */
|
||||
while (!other.empty() && Traits::IsSeparator(other.front()))
|
||||
other.pop_front();
|
||||
other.remove_prefix(1);
|
||||
}
|
||||
|
||||
return other;
|
||||
|
Loading…
Reference in New Issue
Block a user