Fixed arch build

This commit is contained in:
emeric
2022-05-28 14:57:39 +02:00
parent 558ffe1d87
commit 657b35d541
8 changed files with 75 additions and 18 deletions
@@ -67,7 +67,12 @@ std::vector<std::filesystem::path>
ScanSettings::getAudioFileExtensions() const
{
const auto extensions {StringUtils::splitString(_audioFileExtensions, " ")};
return std::vector<std::filesystem::path>(std::cbegin(extensions), std::cend(extensions));
std::vector<std::filesystem::path> res (std::cbegin(extensions), std::cend(extensions));
std::sort(std::begin(res), std::end(res));
res.erase(std::unique( std::begin(res), std::end(res)), std::end(res));
return res;
}
void
@@ -69,11 +69,11 @@ getNextFirstOfMonth(Wt::WDate current)
}
bool
isFileSupported(const std::filesystem::path& file, const std::unordered_set<std::filesystem::path>& extensions)
isFileSupported(const std::filesystem::path& file, const std::vector<std::filesystem::path>& extensions)
{
const std::filesystem::path extension {StringUtils::stringToLower(file.extension().string())};
return (extensions.find(extension) != extensions.end());
return (std::find(std::cbegin(extensions), std::cend(extensions), extension) != std::cend(extensions));
}
bool
@@ -642,7 +642,7 @@ ScannerService::refreshScanSettings()
{
const auto fileExtensions {scanSettings->getAudioFileExtensions()};
_fileExtensions.clear();
std::transform(std::cbegin(fileExtensions), std::end(fileExtensions), std::inserter(_fileExtensions, std::begin(_fileExtensions)),
std::transform(std::cbegin(fileExtensions), std::end(fileExtensions), std::back_inserter(_fileExtensions),
[](const std::filesystem::path& extension) { return std::filesystem::path{ StringUtils::stringToLower(extension.string()) }; });
}
_mediaDirectory = scanSettings->getMediaDirectory();
@@ -896,7 +896,7 @@ ScannerService::scanMediaDirectory(const std::filesystem::path& mediaDirectory,
// Check if a file exists and is still in a media directory
static bool
checkFile(const std::filesystem::path& p, const std::filesystem::path& mediaDirectory, const std::unordered_set<std::filesystem::path>& extensions)
checkFile(const std::filesystem::path& p, const std::filesystem::path& mediaDirectory, const std::vector<std::filesystem::path>& extensions)
{
try
{
@@ -22,7 +22,7 @@
#include <chrono>
#include <shared_mutex>
#include <optional>
#include <unordered_set>
#include <vector>
#include <Wt/WDateTime.h>
#include <Wt/WIOService.h>
@@ -114,7 +114,7 @@ namespace Scanner
std::size_t _scanVersion {};
Wt::WTime _startTime;
Database::ScanSettings::UpdatePeriod _updatePeriod {Database::ScanSettings::UpdatePeriod::Never};
std::unordered_set<std::filesystem::path> _fileExtensions;
std::vector<std::filesystem::path> _fileExtensions;
std::filesystem::path _mediaDirectory;
Database::ScanSettings::RecommendationEngineType _recommendationServiceType;
};
-8
View File
@@ -38,11 +38,3 @@ Wt::WDateTime getLastWriteTime(const std::filesystem::path& dir);
// returns false if aborted by user
bool exploreFilesRecursive(const std::filesystem::path& directory, std::function<bool(std::error_code, const std::filesystem::path&)> cb, const std::filesystem::path& excludeDirFileName = {});
namespace std
{
template <>
struct hash<std::filesystem::path>
{
inline std::size_t operator()(const std::filesystem::path &path) const { return hash_value(path); }
};
}