v30.3-roots.1 · Commit 2: [PATCH 02/68] feat(runtime): preserve Roots operator controls on Core 30.3
src/util/fs_helpers.h
Before: src/util/fs_helpers.h · After: src/util/fs_helpers.h
File metadata
index 4d11f828092ad832b0a3c344e9756a80ed1c5e84..b07ca747e32d9823ad57a087ff79bd3c765b5428 100644
Download original patch · Release notes
Diff rows 1–38 of 38. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
src/util/fs_helpers.h
CHANGED
|
@@ -72,6 +72,15 @@ bool CheckDiskSpace(const fs::path& dir, uint64_t additional_bytes = 0);
|
|
|
72
72
|
*/
|
|
73
73
|
std::streampos GetFileSize(const char* path, std::streamsize max = std::numeric_limits<std::streamsize>::max());
|
|
74
74
|
|
|
75
|
+
//! Return the original FILE* unchanged. On systems that support it,
|
|
76
|
+
//! also advise the OS that the file will be accessed sequentially.
|
|
77
|
+
FILE* AdviseSequential(FILE*);
|
|
78
|
+
|
|
79
|
+
//! Close a file and return the result of fclose(). On systems that
|
|
80
|
+
//! support it, advise the OS to remove the file contents from the page
|
|
81
|
+
//! cache (which can help on memory-constrained systems).
|
|
82
|
+
int CloseAndUncache(FILE*);
|
|
83
|
+
|
|
75
84
|
/** Release all directory locks. This is used for unit testing only, at runtime
|
|
76
85
|
* the global destructor will take care of the locks.
|
|
77
86
|
*/
|
|
@@ -93,8 +102,23 @@ std::string PermsToSymbolicString(fs::perms p);
|
|
|
93
102
|
*/
|
|
94
103
|
std::optional<fs::perms> InterpretPermString(const std::string& s);
|
|
95
104
|
|
|
105
|
+
/** Check if a directory is writable by creating a temporary file on it.
|
|
106
|
+
*
|
|
107
|
+
* @param[in] dir_path Path of the directory to test
|
|
108
|
+
* @return true if a temporary file could be created and removed, false otherwise.
|
|
109
|
+
* @throw std::runtime_error if dir_path is not a directory.
|
|
110
|
+
*/
|
|
111
|
+
bool IsDirWritable(const fs::path& dir_path);
|
|
112
|
+
|
|
96
113
|
#ifdef WIN32
|
|
97
114
|
fs::path GetSpecialFolderPath(int nFolder, bool fCreate = true);
|
|
98
115
|
#endif
|
|
99
116
|
|
|
117
|
+
/** Determine whether the given path is a symbolic link or a reparse point on windows
|
|
118
|
+
*
|
|
119
|
+
* @param[in] path The path to check
|
|
120
|
+
* @return Whether path is a symlink or reparse point
|
|
121
|
+
*/
|
|
122
|
+
bool IsSymlink(const fs::path& path);
|
|
123
|
+
|
|
100
124
|
#endif // BITCOIN_UTIL_FS_HELPERS_H
|