diff options
| author | 2019-05-23 14:22:09 -0400 | |
|---|---|---|
| committer | 2019-05-23 14:22:12 -0400 | |
| commit | 943f6da1ac507daec404d593a331cc37c9ab64df (patch) | |
| tree | cc5777975f6ac9c4e9b86c463d9a8f19de0459e6 /src/common/file_util.cpp | |
| parent | common/file_util: Make ReadFileToString and WriteStringToFile consistent (diff) | |
| download | yuzu-943f6da1ac507daec404d593a331cc37c9ab64df.tar.gz yuzu-943f6da1ac507daec404d593a331cc37c9ab64df.tar.xz yuzu-943f6da1ac507daec404d593a331cc37c9ab64df.zip | |
common/file_util: Remove duplicated documentation comments
These are already present within the header, so they don't need to be
repeated in the cpp file.
Diffstat (limited to '')
| -rw-r--r-- | src/common/file_util.cpp | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 8a902dd68..740310807 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp | |||
| @@ -87,7 +87,6 @@ static void StripTailDirSlashes(std::string& fname) { | |||
| 87 | return; | 87 | return; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | // Returns true if file filename exists | ||
| 91 | bool Exists(const std::string& filename) { | 90 | bool Exists(const std::string& filename) { |
| 92 | struct stat file_info; | 91 | struct stat file_info; |
| 93 | 92 | ||
| @@ -107,7 +106,6 @@ bool Exists(const std::string& filename) { | |||
| 107 | return (result == 0); | 106 | return (result == 0); |
| 108 | } | 107 | } |
| 109 | 108 | ||
| 110 | // Returns true if filename is a directory | ||
| 111 | bool IsDirectory(const std::string& filename) { | 109 | bool IsDirectory(const std::string& filename) { |
| 112 | struct stat file_info; | 110 | struct stat file_info; |
| 113 | 111 | ||
| @@ -132,8 +130,6 @@ bool IsDirectory(const std::string& filename) { | |||
| 132 | return S_ISDIR(file_info.st_mode); | 130 | return S_ISDIR(file_info.st_mode); |
| 133 | } | 131 | } |
| 134 | 132 | ||
| 135 | // Deletes a given filename, return true on success | ||
| 136 | // Doesn't supports deleting a directory | ||
| 137 | bool Delete(const std::string& filename) { | 133 | bool Delete(const std::string& filename) { |
| 138 | LOG_TRACE(Common_Filesystem, "file {}", filename); | 134 | LOG_TRACE(Common_Filesystem, "file {}", filename); |
| 139 | 135 | ||
| @@ -165,7 +161,6 @@ bool Delete(const std::string& filename) { | |||
| 165 | return true; | 161 | return true; |
| 166 | } | 162 | } |
| 167 | 163 | ||
| 168 | // Returns true if successful, or path already exists. | ||
| 169 | bool CreateDir(const std::string& path) { | 164 | bool CreateDir(const std::string& path) { |
| 170 | LOG_TRACE(Common_Filesystem, "directory {}", path); | 165 | LOG_TRACE(Common_Filesystem, "directory {}", path); |
| 171 | #ifdef _WIN32 | 166 | #ifdef _WIN32 |
| @@ -194,7 +189,6 @@ bool CreateDir(const std::string& path) { | |||
| 194 | #endif | 189 | #endif |
| 195 | } | 190 | } |
| 196 | 191 | ||
| 197 | // Creates the full path of fullPath returns true on success | ||
| 198 | bool CreateFullPath(const std::string& fullPath) { | 192 | bool CreateFullPath(const std::string& fullPath) { |
| 199 | int panicCounter = 100; | 193 | int panicCounter = 100; |
| 200 | LOG_TRACE(Common_Filesystem, "path {}", fullPath); | 194 | LOG_TRACE(Common_Filesystem, "path {}", fullPath); |
| @@ -230,7 +224,6 @@ bool CreateFullPath(const std::string& fullPath) { | |||
| 230 | } | 224 | } |
| 231 | } | 225 | } |
| 232 | 226 | ||
| 233 | // Deletes a directory filename, returns true on success | ||
| 234 | bool DeleteDir(const std::string& filename) { | 227 | bool DeleteDir(const std::string& filename) { |
| 235 | LOG_TRACE(Common_Filesystem, "directory {}", filename); | 228 | LOG_TRACE(Common_Filesystem, "directory {}", filename); |
| 236 | 229 | ||
| @@ -252,7 +245,6 @@ bool DeleteDir(const std::string& filename) { | |||
| 252 | return false; | 245 | return false; |
| 253 | } | 246 | } |
| 254 | 247 | ||
| 255 | // renames file srcFilename to destFilename, returns true on success | ||
| 256 | bool Rename(const std::string& srcFilename, const std::string& destFilename) { | 248 | bool Rename(const std::string& srcFilename, const std::string& destFilename) { |
| 257 | LOG_TRACE(Common_Filesystem, "{} --> {}", srcFilename, destFilename); | 249 | LOG_TRACE(Common_Filesystem, "{} --> {}", srcFilename, destFilename); |
| 258 | #ifdef _WIN32 | 250 | #ifdef _WIN32 |
| @@ -268,7 +260,6 @@ bool Rename(const std::string& srcFilename, const std::string& destFilename) { | |||
| 268 | return false; | 260 | return false; |
| 269 | } | 261 | } |
| 270 | 262 | ||
| 271 | // copies file srcFilename to destFilename, returns true on success | ||
| 272 | bool Copy(const std::string& srcFilename, const std::string& destFilename) { | 263 | bool Copy(const std::string& srcFilename, const std::string& destFilename) { |
| 273 | LOG_TRACE(Common_Filesystem, "{} --> {}", srcFilename, destFilename); | 264 | LOG_TRACE(Common_Filesystem, "{} --> {}", srcFilename, destFilename); |
| 274 | #ifdef _WIN32 | 265 | #ifdef _WIN32 |
| @@ -324,7 +315,6 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename) { | |||
| 324 | #endif | 315 | #endif |
| 325 | } | 316 | } |
| 326 | 317 | ||
| 327 | // Returns the size of filename (64bit) | ||
| 328 | u64 GetSize(const std::string& filename) { | 318 | u64 GetSize(const std::string& filename) { |
| 329 | if (!Exists(filename)) { | 319 | if (!Exists(filename)) { |
| 330 | LOG_ERROR(Common_Filesystem, "failed {}: No such file", filename); | 320 | LOG_ERROR(Common_Filesystem, "failed {}: No such file", filename); |
| @@ -351,7 +341,6 @@ u64 GetSize(const std::string& filename) { | |||
| 351 | return 0; | 341 | return 0; |
| 352 | } | 342 | } |
| 353 | 343 | ||
| 354 | // Overloaded GetSize, accepts file descriptor | ||
| 355 | u64 GetSize(const int fd) { | 344 | u64 GetSize(const int fd) { |
| 356 | struct stat buf; | 345 | struct stat buf; |
| 357 | if (fstat(fd, &buf) != 0) { | 346 | if (fstat(fd, &buf) != 0) { |
| @@ -361,7 +350,6 @@ u64 GetSize(const int fd) { | |||
| 361 | return buf.st_size; | 350 | return buf.st_size; |
| 362 | } | 351 | } |
| 363 | 352 | ||
| 364 | // Overloaded GetSize, accepts FILE* | ||
| 365 | u64 GetSize(FILE* f) { | 353 | u64 GetSize(FILE* f) { |
| 366 | // can't use off_t here because it can be 32-bit | 354 | // can't use off_t here because it can be 32-bit |
| 367 | u64 pos = ftello(f); | 355 | u64 pos = ftello(f); |
| @@ -377,7 +365,6 @@ u64 GetSize(FILE* f) { | |||
| 377 | return size; | 365 | return size; |
| 378 | } | 366 | } |
| 379 | 367 | ||
| 380 | // creates an empty file filename, returns true on success | ||
| 381 | bool CreateEmptyFile(const std::string& filename) { | 368 | bool CreateEmptyFile(const std::string& filename) { |
| 382 | LOG_TRACE(Common_Filesystem, "{}", filename); | 369 | LOG_TRACE(Common_Filesystem, "{}", filename); |
| 383 | 370 | ||
| @@ -502,7 +489,6 @@ bool DeleteDirRecursively(const std::string& directory, unsigned int recursion) | |||
| 502 | return true; | 489 | return true; |
| 503 | } | 490 | } |
| 504 | 491 | ||
| 505 | // Create directory and copy contents (does not overwrite existing files) | ||
| 506 | void CopyDir(const std::string& source_path, const std::string& dest_path) { | 492 | void CopyDir(const std::string& source_path, const std::string& dest_path) { |
| 507 | #ifndef _WIN32 | 493 | #ifndef _WIN32 |
| 508 | if (source_path == dest_path) | 494 | if (source_path == dest_path) |
| @@ -539,7 +525,6 @@ void CopyDir(const std::string& source_path, const std::string& dest_path) { | |||
| 539 | #endif | 525 | #endif |
| 540 | } | 526 | } |
| 541 | 527 | ||
| 542 | // Returns the current directory | ||
| 543 | std::string GetCurrentDir() { | 528 | std::string GetCurrentDir() { |
| 544 | // Get the current working directory (getcwd uses malloc) | 529 | // Get the current working directory (getcwd uses malloc) |
| 545 | #ifdef _WIN32 | 530 | #ifdef _WIN32 |
| @@ -561,7 +546,6 @@ std::string GetCurrentDir() { | |||
| 561 | return strDir; | 546 | return strDir; |
| 562 | } | 547 | } |
| 563 | 548 | ||
| 564 | // Sets the current directory to the given directory | ||
| 565 | bool SetCurrentDir(const std::string& directory) { | 549 | bool SetCurrentDir(const std::string& directory) { |
| 566 | #ifdef _WIN32 | 550 | #ifdef _WIN32 |
| 567 | return _wchdir(Common::UTF8ToUTF16W(directory).c_str()) == 0; | 551 | return _wchdir(Common::UTF8ToUTF16W(directory).c_str()) == 0; |
| @@ -673,8 +657,6 @@ std::string GetSysDirectory() { | |||
| 673 | return sysDir; | 657 | return sysDir; |
| 674 | } | 658 | } |
| 675 | 659 | ||
| 676 | // Returns a string with a yuzu data dir or file in the user's home | ||
| 677 | // directory. To be used in "multi-user" mode (that is, installed). | ||
| 678 | const std::string& GetUserPath(UserPath path, const std::string& new_path) { | 660 | const std::string& GetUserPath(UserPath path, const std::string& new_path) { |
| 679 | static std::unordered_map<UserPath, std::string> paths; | 661 | static std::unordered_map<UserPath, std::string> paths; |
| 680 | auto& user_path = paths[UserPath::UserDir]; | 662 | auto& user_path = paths[UserPath::UserDir]; |
| @@ -776,13 +758,6 @@ std::size_t ReadFileToString(bool text_file, const std::string& filename, std::s | |||
| 776 | return file.ReadArray(&str[0], str.size()); | 758 | return file.ReadArray(&str[0], str.size()); |
| 777 | } | 759 | } |
| 778 | 760 | ||
| 779 | /** | ||
| 780 | * Splits the filename into 8.3 format | ||
| 781 | * Loosely implemented following https://en.wikipedia.org/wiki/8.3_filename | ||
| 782 | * @param filename The normal filename to use | ||
| 783 | * @param short_name A 9-char array in which the short name will be written | ||
| 784 | * @param extension A 4-char array in which the extension will be written | ||
| 785 | */ | ||
| 786 | void SplitFilename83(const std::string& filename, std::array<char, 9>& short_name, | 761 | void SplitFilename83(const std::string& filename, std::array<char, 9>& short_name, |
| 787 | std::array<char, 4>& extension) { | 762 | std::array<char, 4>& extension) { |
| 788 | const std::string forbidden_characters = ".\"/\\[]:;=, "; | 763 | const std::string forbidden_characters = ".\"/\\[]:;=, "; |