Luna/libos/include/os/FileSystem.h

32 lines
798 B
C
Raw Normal View History

2023-04-13 16:33:04 +00:00
#pragma once
2023-05-12 21:47:20 +00:00
#include <bits/struct_stat.h>
2023-04-13 16:33:04 +00:00
#include <luna/Result.h>
#include <luna/StringView.h>
#include <os/Path.h>
2023-04-13 16:33:04 +00:00
#include <sys/types.h>
namespace os
{
namespace FileSystem
{
2023-05-20 19:48:18 +00:00
bool exists(const Path& path, bool follow_symlinks = true);
2023-04-13 16:33:04 +00:00
2023-05-20 19:48:18 +00:00
bool is_directory(const Path& path, bool follow_symlinks = false);
2023-04-13 16:33:04 +00:00
2023-05-20 19:48:18 +00:00
Result<void> stat(const Path& path, struct stat& st, bool follow_symlinks = true);
2023-05-12 21:47:20 +00:00
2023-04-13 16:33:04 +00:00
Result<void> create_directory(StringView path, mode_t mode);
Result<void> remove(const Path& path);
Result<void> remove_tree(const Path& path);
2023-04-13 16:33:04 +00:00
2023-05-23 13:42:38 +00:00
Result<String> readlink(const Path& path);
2023-04-13 16:33:04 +00:00
Result<String> working_directory();
Result<String> home_directory();
2023-04-18 16:46:19 +00:00
Result<void> change_directory(StringView path);
2023-04-13 16:33:04 +00:00
}
}