Updated Library Documentation (markdown)

2025-09-02 19:17:47 +03:00
parent 61cd39436c
commit 780aeb3885

@@ -302,7 +302,7 @@ int main(int argc, char** argv) {
### Functions
`libhelper` provides many helper functions. Some of these throw `Helper::Error`. We'll cover each one with code examples.
#### Checkers (not throws Helper::Error)
#### Checkers
* `bool hasSuperUser()` - It is checked whether the user ID used is equivalent to AID_ROOT. See include/private/android_filesystem_config.h
* `bool hasAdbPermissions()` - It is checked whether the user ID used is equivalent to AID_SHELL. See include/private/android_filesystem_config.h
@@ -315,7 +315,7 @@ int main(int argc, char** argv) {
* `bool isHardLink(std::string_view entry)` - Checks if the entry is a hard link.
* `bool areLinked(std::string_view entry1, std::string_view entry2)` - Checks whether entry1 is linked to entry2.
#### File I/O (not throws Helper::Error)
#### File I/O
* `bool writeFile(std::string_view file, std::string_view text)` - Writes given text into file. If file does not exist, it is automatically created. Returns true on success.
* `std::optional<std::string> readFile(std::string_view file)` - Reads file content into string. On success returns file content. On error returns std::nullopt.
@@ -327,12 +327,12 @@ int main(int argc, char** argv) {
* `bool createFile(std::string_view path)` - Create file.
* `bool createSymlink(std::string_view entry1, std::string_view entry2)` - Symlink entry1 to entry2.
#### Removers (not throws Helper::Error)
#### Removers
* `bool eraseEntry(std::string_view entry)` - Remove file or empty directory.
* `bool eraseDirectoryRecursive(std::string_view directory)` - Remove directory and all directory contents recursively.
#### Getters (not throws Helper::Error)
#### Getters
* `int64_t fileSize(std::string_view file)` - Get file size.
* `std::string readSymlink(std::string_view entry)` - Read symlinks.
@@ -342,7 +342,7 @@ int main(int argc, char** argv) {
* `bool sha256Compare(std::string_view file1, std::string_view file2)` - Compare SHA-256 values of files. Throws Helper::Error on error occurred.
* `std::optional<std::string> sha256Of(std::string_view path)` - Get SHA-256 of file. Throws Helper::Error on error occurred.
#### Utilities (not throws Helper::Error)
#### Utilities
* `bool copyFile(std::string_view file, std::string_view dest)` - Copy file to dest.
* `bool runCommand(std::string_view cmd)` - Run shell command.