mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-30 01:16:16 +02:00
Use utils::file::exists instead of std::filesystem
This commit is contained in:
parent
98ccc8eded
commit
3f208d260e
5 changed files with 29 additions and 23 deletions
|
@ -32,7 +32,6 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
@ -44,13 +43,26 @@ namespace file
|
|||
{
|
||||
|
||||
|
||||
static bool exists(const std::string& filename)
|
||||
{
|
||||
if (filename.empty())
|
||||
return false;
|
||||
#ifdef WINDOWS
|
||||
DWORD dwAttrib = GetFileAttributes(filename.c_str());
|
||||
return (dwAttrib != INVALID_FILE_ATTRIBUTES);
|
||||
#else
|
||||
struct stat buffer;
|
||||
return (stat(filename.c_str(), &buffer) == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef WINDOWS
|
||||
static void do_chown(const std::string& file_path, const std::string& user_name, const std::string& group_name)
|
||||
{
|
||||
if (user_name.empty() && group_name.empty())
|
||||
return;
|
||||
|
||||
if (!std::filesystem::exists(file_path))
|
||||
if (!utils::file::exists(file_path))
|
||||
return;
|
||||
|
||||
uid_t uid = -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue