mirror of
https://github.com/NixOS/nix
synced 2025-06-28 01:11:15 +02:00
Use std::filesystem::path
in more places (#10657)
Progress on #9205 Co-Authored-By: John Ericson <John.Ericson@Obsidian.Systems> * Get rid of `PathNG`, just use `std::filesystem::path`
This commit is contained in:
parent
9ae6455b0e
commit
fcbc36cf78
13 changed files with 104 additions and 82 deletions
|
@ -9,6 +9,7 @@
|
|||
#include "error.hh"
|
||||
#include "logging.hh"
|
||||
#include "file-descriptor.hh"
|
||||
#include "file-path.hh"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -149,9 +150,9 @@ void syncParent(const Path & path);
|
|||
* recursively. It's not an error if the path does not exist. The
|
||||
* second variant returns the number of bytes and blocks freed.
|
||||
*/
|
||||
void deletePath(const Path & path);
|
||||
void deletePath(const std::filesystem::path & path);
|
||||
|
||||
void deletePath(const Path & path, uint64_t & bytesFreed);
|
||||
void deletePath(const std::filesystem::path & path, uint64_t & bytesFreed);
|
||||
|
||||
/**
|
||||
* Create a directory and all its parents, if necessary. Returns the
|
||||
|
@ -197,17 +198,23 @@ void copyFile(const Path & oldPath, const Path & newPath, bool andDelete);
|
|||
*/
|
||||
class AutoDelete
|
||||
{
|
||||
Path path;
|
||||
std::filesystem::path _path;
|
||||
bool del;
|
||||
bool recursive;
|
||||
public:
|
||||
AutoDelete();
|
||||
AutoDelete(const Path & p, bool recursive = true);
|
||||
AutoDelete(const std::filesystem::path & p, bool recursive = true);
|
||||
~AutoDelete();
|
||||
|
||||
void cancel();
|
||||
void reset(const Path & p, bool recursive = true);
|
||||
operator Path() const { return path; }
|
||||
operator PathView() const { return path; }
|
||||
|
||||
void reset(const std::filesystem::path & p, bool recursive = true);
|
||||
|
||||
const std::filesystem::path & path() const { return _path; }
|
||||
PathViewNG view() const { return _path; }
|
||||
|
||||
operator const std::filesystem::path & () const { return _path; }
|
||||
operator PathViewNG () const { return _path; }
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue