diff options
author | danlark <danlark@yandex-team.ru> | 2022-02-10 16:46:10 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:10 +0300 |
commit | baa58daefa91fde4b4769facdbd2903763b9c6a8 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/folder/dirut.cpp | |
parent | 3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (diff) | |
download | ydb-baa58daefa91fde4b4769facdbd2903763b9c6a8.tar.gz |
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 2 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 57bc56003f..ffc9b09f96 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; |