diff options
author | danlark <danlark@yandex-team.ru> | 2022-02-10 16:46:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:08 +0300 |
commit | 3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (patch) | |
tree | 26154e1e9990f1bb4525d3e3fb5b6dac2c2c1da2 /util/folder/dirut.cpp | |
parent | cb68f224c46a8ee52ac3fdd2a32534b8bb8dc134 (diff) | |
download | ydb-3426a9bc7f169ae9da54cef557ad2a33f6e8eee0.tar.gz |
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/folder/dirut.cpp')
-rw-r--r-- | util/folder/dirut.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/util/folder/dirut.cpp b/util/folder/dirut.cpp index ffc9b09f96..57bc56003f 100644 --- a/util/folder/dirut.cpp +++ b/util/folder/dirut.cpp @@ -19,7 +19,7 @@ void SlashFolderLocal(TString& folder) { while ((pos = folder.find('/')) != TString::npos) folder.replace(pos, 1, LOCSLASH_S); #endif - if (folder[folder.size() - 1] != LOCSLASH_C) + if (folder[folder.size() - 1] != LOCSLASH_C) folder.append(LOCSLASH_S); } @@ -41,10 +41,10 @@ bool resolvepath(TString& folder, const TString& home) { if (folder.at(0) == '~') { if (folder.length() == 1 || folder.at(1) == '/') { - folder = GetHomeDir() + (folder.data() + 1); + folder = GetHomeDir() + (folder.data() + 1); } else { char* buf = (char*)alloca(folder.length() + 1); - strcpy(buf, folder.data() + 1); + strcpy(buf, folder.data() + 1); char* p = strchr(buf, '/'); if (p) *p++ = 0; @@ -62,10 +62,10 @@ bool resolvepath(TString& folder, const TString& home) { int len = folder.length() + home.length() + 1; char* path = (char*)alloca(len); if (folder.at(0) != '/') { - strcpy(path, home.data()); - strcpy(strrchr(path, '/') + 1, folder.data()); // the last char must be '/' if it's a dir + strcpy(path, home.data()); + strcpy(strrchr(path, '/') + 1, folder.data()); // the last char must be '/' if it's a dir } else { - strcpy(path, folder.data()); + strcpy(path, folder.data()); } len = strlen(path) + 1; // grabbed from url.cpp @@ -349,8 +349,8 @@ int resolvepath(char* apath, const char* rpath, const char* cpath) { } bool correctpath(TString& filename) { - char* ptr = (char*)alloca(filename.size() + 2); - if (correctpath(ptr, filename.data())) { + char* ptr = (char*)alloca(filename.size() + 2); + if (correctpath(ptr, filename.data())) { filename = ptr; return true; } @@ -358,8 +358,8 @@ bool correctpath(TString& filename) { } bool resolvepath(TString& folder, const TString& home) { - char* ptr = (char*)alloca(folder.size() + 3 + home.size()); - if (resolvepath(ptr, folder.data(), home.data())) { + char* ptr = (char*)alloca(folder.size() + 3 + home.size()); + if (resolvepath(ptr, folder.data(), home.data())) { folder = ptr; return true; } @@ -406,9 +406,9 @@ TString RealPath(const TString& path) { TTempBuf result; Y_ASSERT(result.Size() > MAX_PATH); //TMP_BUF_LEN > MAX_PATH #ifdef _win_ - if (GetFullPathName(path.data(), result.Size(), result.Data(), nullptr) == 0) + if (GetFullPathName(path.data(), result.Size(), result.Data(), nullptr) == 0) #else - if (realpath(path.data(), result.Data()) == nullptr) + if (realpath(path.data(), result.Data()) == nullptr) #endif ythrow TFileError() << "RealPath failed \"" << path << "\""; return result.Data(); @@ -419,7 +419,7 @@ TString RealLocation(const TString& path) { return RealPath(path); TString dirpath = GetDirName(path); if (NFs::Exists(dirpath)) - return RealPath(dirpath) + GetDirectorySeparatorS() + GetFileNameComponent(path.data()); + return RealPath(dirpath) + GetDirectorySeparatorS() + GetFileNameComponent(path.data()); ythrow TFileError() << "RealLocation failed \"" << path << "\""; } @@ -434,7 +434,7 @@ int MakeTempDir(char path[/*FILENAME_MAX*/], const char* prefix) { if (!prefix) { #endif sysTmp = GetSystemTempDir(); - prefix = sysTmp.data(); + prefix = sysTmp.data(); } if ((ret = ResolvePath(prefix, nullptr, path, 1)) != 0) @@ -460,7 +460,7 @@ TString GetHomeDir() { passwd* pw = nullptr; s = getenv("USER"); if (s) - pw = getpwnam(s.data()); + pw = getpwnam(s.data()); else pw = getpwuid(getuid()); if (pw) @@ -580,13 +580,13 @@ int ResolvePath(const char* rel, const char* abs, char res[/*MAXPATHLEN*/], bool t[len] = 0; } if (!realpath(t, res)) { - if (!isdir && realpath(GetDirName(t).data(), res)) { + if (!isdir && realpath(GetDirName(t).data(), res)) { len = strlen(res); if (res[len - 1] != LOCSLASH_C) { res[len++] = LOCSLASH_C; res[len] = 0; } - strcpy(res + len, GetBaseName(t).data()); + strcpy(res + len, GetBaseName(t).data()); return 0; } return errno ? errno : ENOENT; |