db/update/IO: pass std::string_view to directory_child_is_regular()
This commit is contained in:
parent
6197b29aa0
commit
d5fd309484
@ -66,7 +66,7 @@ DirectoryExists(Storage &storage, const Directory &directory) noexcept
|
||||
|
||||
static StorageFileInfo
|
||||
GetDirectoryChildInfo(Storage &storage, const Directory &directory,
|
||||
const char *name_utf8)
|
||||
std::string_view name_utf8)
|
||||
{
|
||||
const auto uri_utf8 = PathTraitsUTF8::Build(directory.GetPath(),
|
||||
name_utf8);
|
||||
@ -75,7 +75,7 @@ GetDirectoryChildInfo(Storage &storage, const Directory &directory,
|
||||
|
||||
bool
|
||||
directory_child_is_regular(Storage &storage, const Directory &directory,
|
||||
const char *name_utf8) noexcept
|
||||
std::string_view name_utf8) noexcept
|
||||
try {
|
||||
return GetDirectoryChildInfo(storage, directory, name_utf8)
|
||||
.IsRegular();
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string_view>
|
||||
|
||||
struct Directory;
|
||||
struct StorageFileInfo;
|
||||
class Storage;
|
||||
@ -48,7 +50,7 @@ DirectoryExists(Storage &storage, const Directory &directory) noexcept;
|
||||
gcc_pure
|
||||
bool
|
||||
directory_child_is_regular(Storage &storage, const Directory &directory,
|
||||
const char *name_utf8) noexcept;
|
||||
std::string_view name_utf8) noexcept;
|
||||
|
||||
/**
|
||||
* Checks if the given permissions on the mapped file are given.
|
||||
|
@ -103,7 +103,7 @@ UpdateWalk::PurgeDeletedFromDirectory(Directory &directory) noexcept
|
||||
|
||||
directory.ForEachSongSafe([&](Song &song){
|
||||
if (!directory_child_is_regular(storage, directory,
|
||||
song.filename.c_str())) {
|
||||
song.filename)) {
|
||||
editor.LockDeleteSong(directory, &song);
|
||||
|
||||
modified = true;
|
||||
@ -113,8 +113,7 @@ UpdateWalk::PurgeDeletedFromDirectory(Directory &directory) noexcept
|
||||
for (auto i = directory.playlists.begin(),
|
||||
end = directory.playlists.end();
|
||||
i != end;) {
|
||||
if (!directory_child_is_regular(storage, directory,
|
||||
i->name.c_str())) {
|
||||
if (!directory_child_is_regular(storage, directory, i->name)) {
|
||||
const ScopeDatabaseLock protect;
|
||||
i = directory.playlists.erase(i);
|
||||
} else
|
||||
|
Loading…
Reference in New Issue
Block a user