|
xapian-core
2.0.0
|
Utility functions for testing files. More...
Include dependency graph for filetests.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Typedefs | |
| typedef std::make_unsigned_t< off_t > | file_size_type |
| Unsigned return type of file_size() function. More... | |
Functions | |
| bool | file_exists (const char *path) |
| Test if a file exists. More... | |
| bool | file_exists (const std::string &path) |
| Test if a file exists. More... | |
| file_size_type | file_size (const char *path) |
| Returns the size of a file. More... | |
| file_size_type | file_size (const std::string &path) |
| Returns the size of a file. More... | |
| file_size_type | file_size (int fd) |
| Returns the size of a file. More... | |
| bool | dir_exists (const char *path) |
| Test if a directory exists. More... | |
| bool | dir_exists (const std::string &path) |
| Test if a directory exists. More... | |
| bool | path_exists (const char *path) |
| Test if a path exists. More... | |
| bool | path_exists (const std::string &path) |
| Test if a path exists. More... | |
Utility functions for testing files.
Definition in file filetests.h.
| typedef std::make_unsigned_t<off_t> file_size_type |
Unsigned return type of file_size() function.
Definition at line 57 of file filetests.h.
|
inline |
Test if a directory exists.
| path | The path to test |
Definition at line 145 of file filetests.h.
References S_ISDIR.
Referenced by Xapian::Database::compact_(), BackendManager::create_dir_if_needed(), DEFINE_TESTCASE(), dir_exists(), BackendManagerGlass::do_get_database_path(), BackendManagerHoney::do_get_database_path(), GlassDatabase::GlassDatabase(), Xapian::DatabaseReplica::Internal::Internal(), main(), and rm_rf().
|
inline |
Test if a directory exists.
| path | The path to test |
Definition at line 157 of file filetests.h.
References dir_exists().
|
inline |
Test if a file exists.
| path | The path to test |
Definition at line 40 of file filetests.h.
References S_ISREG.
Referenced by check_db_dir(), check_glass_table(), Xapian::Database::compact_(), BackendManagerMulti::createdb_multi(), Xapian::Database::Database(), DEFINE_TESTCASE(), BackendManagerSingleFile::do_get_database_path(), GlassTable::exists(), file_exists(), test_driver::get_srcdir(), Xapian::DatabaseReplicator::open(), and Xapian::WritableDatabase::WritableDatabase().
|
inline |
Test if a file exists.
| path | The path to test |
Definition at line 52 of file filetests.h.
References file_exists().
|
inline |
Returns the size of a file.
| path | The path to test |
errno is set to 0 (upon success), or the error returned by stat(), or EINVAL (if the path isn't a regular file or a symlink resolving to a regular file).
If the file's size is larger than the maximum value off_t can represent, then stat() will fail with errno=EOVERFLOW, and so will this function. There doesn't seem to be a way to determine the file size in this case, short of reading it all. This is only likely if the LFS check in configure doesn't work out how to enable largefile support.
Definition at line 76 of file filetests.h.
References S_ISREG.
Referenced by GlassDatabase::compact(), HoneyDatabase::compact(), file_size(), replicate_with_brokenness(), and RemoteConnection::send_file().
|
inline |
Returns the size of a file.
| path | The path to test |
errno is set to 0 (upon success), or the error returned by stat(), or EINVAL (if the path isn't a regular file or a symlink resolving to a regular file).
If the file's size is larger than the maximum value off_t can represent, then stat() will fail with errno=EOVERFLOW, and so will this function. There doesn't seem to be a way to determine the file size in this case, short of reading it all. This is only likely if the LFS check in configure doesn't work out how to enable largefile support.
Definition at line 105 of file filetests.h.
References file_size().
|
inline |
Returns the size of a file.
| fd | The file descriptor for the file. |
errno is set to 0 (upon success), or the error returned by fstat(), or EINVAL (if the fd isn't a regular file or a symlink resolving to a regular file).
If the file's size is larger than the maximum value off_t can represent, then stat() will fail with errno=EOVERFLOW, and so will this function. There doesn't seem to be a way to determine the file size in this case, short of reading it all. This is only likely if the LFS check in configure doesn't work out how to enable largefile support.
Definition at line 126 of file filetests.h.
References S_ISREG.
|
inline |
Test if a path exists.
| path | The path to test |
Definition at line 167 of file filetests.h.
Referenced by BackendManager::get_database(), BackendManager::get_database_path(), and path_exists().
|
inline |
Test if a path exists.
| path | The path to test |
Definition at line 178 of file filetests.h.
References path_exists().