diff options
author | Vlad Yaroslavlev <vladon@vladon.com> | 2022-02-10 16:46:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:23 +0300 |
commit | 706b83ed7de5a473436620367af31fc0ceecde07 (patch) | |
tree | 103305d30dec77e8f6367753367f59b3cd68f9f1 /util/system/fs.h | |
parent | 918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff) | |
download | ydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz |
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'util/system/fs.h')
-rw-r--r-- | util/system/fs.h | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/util/system/fs.h b/util/system/fs.h index 237daf2d2d..a412f6cb15 100644 --- a/util/system/fs.h +++ b/util/system/fs.h @@ -1,7 +1,7 @@ #pragma once #include <util/generic/flags.h> -#include <util/generic/string.h> +#include <util/generic/string.h> #include <util/generic/yexception.h> namespace NFs { @@ -28,27 +28,27 @@ namespace NFs { /// @param[in] path Path to file or directory /// @returns true on success or false otherwise /// LastSystemError() is set in case of failure - bool Remove(const TString& path); + bool Remove(const TString& path); /// Remove a file or directory with contents /// /// @param[in] path Path to file or directory /// @throws - void RemoveRecursive(const TString& path); + void RemoveRecursive(const TString& path); /// Creates directory /// /// @param[in] path Path to the directory /// @param[in] mode Access permissions field; NOTE: ignored on win /// @returns true on success or false otherwise - bool MakeDirectory(const TString& path, EFilePermissions mode); + bool MakeDirectory(const TString& path, EFilePermissions mode); /// Creates directory /// /// @param[in] path Path to the directory /// @returns true on success or false otherwise /// NOTE: access permissions is set to 0777 - inline bool MakeDirectory(const TString& path) { + inline bool MakeDirectory(const TString& path) { return MakeDirectory(path, FP_COMMON_FILE); } @@ -58,14 +58,14 @@ namespace NFs { /// @param[in] mode Access permissions field; NOTE: ignored on win /// @param[in] alwaysCreate Throw if path already exists or failed to create /// @returns true if target path created or exists (and directory) - bool MakeDirectoryRecursive(const TString& path, EFilePermissions mode, bool alwaysCreate); + bool MakeDirectoryRecursive(const TString& path, EFilePermissions mode, bool alwaysCreate); /// Creates directory and all non-existings parents /// /// @param[in] path Path to be created /// @param[in] mode Access permissions field; NOTE: ignored on win /// @returns true if target path created or exists (and directory) - inline bool MakeDirectoryRecursive(const TString& path, EFilePermissions mode) { + inline bool MakeDirectoryRecursive(const TString& path, EFilePermissions mode) { return MakeDirectoryRecursive(path, mode, false); } @@ -73,7 +73,7 @@ namespace NFs { /// /// @param[in] path Path to be created /// @returns true if target path created or exists (and directory) - inline bool MakeDirectoryRecursive(const TString& path) { + inline bool MakeDirectoryRecursive(const TString& path) { return MakeDirectoryRecursive(path, FP_COMMON_FILE, false); } @@ -84,14 +84,14 @@ namespace NFs { /// @param[in] newPath New path of file or directory /// @returns true on success or false otherwise /// LastSystemError() is set in case of failure - bool Rename(const TString& oldPath, const TString& newPath); + bool Rename(const TString& oldPath, const TString& newPath); /// Creates a new directory entry for a file /// or creates a new one with the same content /// /// @param[in] existingPath Path to an existing file /// @param[in] newPath New path of file - void HardLinkOrCopy(const TString& existingPath, const TString& newPath); + void HardLinkOrCopy(const TString& existingPath, const TString& newPath); /// Creates a new directory entry for a file /// @@ -99,7 +99,7 @@ namespace NFs { /// @param[in] newPath New path of file /// @returns true if new link was created or false otherwise /// LastSystemError() is set in case of failure - bool HardLink(const TString& existingPath, const TString& newPath); + bool HardLink(const TString& existingPath, const TString& newPath); /// Creates a symlink to a file /// @@ -107,47 +107,47 @@ namespace NFs { /// @param[in] linkPath Path of symlink /// @returns true if new link was created or false otherwise /// LastSystemError() is set in case of failure - bool SymLink(const TString& targetPath, const TString& linkPath); + bool SymLink(const TString& targetPath, const TString& linkPath); /// Reads value of a symbolic link /// /// @param[in] path Path to a symlink /// @returns File path that a symlink points to - TString ReadLink(const TString& path); + TString ReadLink(const TString& path); /// Append contents of a file to a new file /// /// @param[in] dstPath Path to a destination file /// @param[in] srcPath Path to a source file - void Cat(const TString& dstPath, const TString& srcPath); + void Cat(const TString& dstPath, const TString& srcPath); /// Copy contents of a file to a new file /// /// @param[in] existingPath Path to an existing file /// @param[in] newPath New path of file - void Copy(const TString& existingPath, const TString& newPath); + void Copy(const TString& existingPath, const TString& newPath); /// Returns path to the current working directory /// /// Note: is not threadsafe - TString CurrentWorkingDirectory(); + TString CurrentWorkingDirectory(); /// Changes current working directory /// /// @param[in] path Path for new cwd /// Note: is not threadsafe - void SetCurrentWorkingDirectory(TString path); + void SetCurrentWorkingDirectory(TString path); /// Checks if file exists /// /// @param[in] path Path to check - bool Exists(const TString& path); + bool Exists(const TString& path); /// Ensures that file exists /// /// @param[in] path Path to check /// @returns input argument - inline const TString& EnsureExists(const TString& path) { + inline const TString& EnsureExists(const TString& path) { Y_ENSURE_EX(Exists(path), TFileError{} << "Path " << path << " does not exists (checked from cwd:" << NFs::CurrentWorkingDirectory() << ")"); return path; } |