polonius/shared/file_is_writable.cpp

18 lines
273 B
C++

/***
* Copyright (C) 2024 rail5
*/
#ifndef FILESYSTEM
#define FILESYSTEM
#include <filesystem>
#endif
#ifndef UNISTD_H
#define UNISTD_H
#include <unistd.h>
#endif
inline bool file_is_writable(std::string filename) {
return (access(filename.c_str(), W_OK) == 0);
}