diff options
author | nalpp <nalpp@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 30d1ef3941e0dc835be7609de5ebee66958f215a (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp | |
parent | 87f3eb38999df2d3c1cb77f8ffb9c52ec9c516fb (diff) | |
download | ydb-30d1ef3941e0dc835be7609de5ebee66958f215a.tar.gz |
Restoring authorship annotation for <nalpp@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp')
-rw-r--r-- | contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp index 18e9f8dd28..c47f750960 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/source/utils/FileSystemUtils.cpp @@ -1,51 +1,51 @@ /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. - */ - -#include <aws/core/utils/FileSystemUtils.h> - -using namespace Aws::Utils; - -Aws::String PathUtils::GetFileNameFromPathWithoutExt(const Aws::String& path) -{ - Aws::String fileName = Aws::Utils::PathUtils::GetFileNameFromPathWithExt(path); - size_t endPos = fileName.find_last_of('.'); - if (endPos == std::string::npos) - { - return fileName; - } - if (endPos == 0) // fileName is "." - { - return {}; - } - - return fileName.substr(0, endPos); -} - -Aws::String PathUtils::GetFileNameFromPathWithExt(const Aws::String& path) -{ - if (path.size() == 0) - { - return path; + */ + +#include <aws/core/utils/FileSystemUtils.h> + +using namespace Aws::Utils; + +Aws::String PathUtils::GetFileNameFromPathWithoutExt(const Aws::String& path) +{ + Aws::String fileName = Aws::Utils::PathUtils::GetFileNameFromPathWithExt(path); + size_t endPos = fileName.find_last_of('.'); + if (endPos == std::string::npos) + { + return fileName; } - - size_t startPos = path.find_last_of(Aws::FileSystem::PATH_DELIM); - if (startPos == path.size() - 1) - { + if (endPos == 0) // fileName is "." + { return {}; - } - - if (startPos == std::string::npos) - { - startPos = 0; - } - else - { - startPos += 1; - } - - size_t endPos = path.size() - 1; - - return path.substr(startPos, endPos - startPos + 1); + } + + return fileName.substr(0, endPos); +} + +Aws::String PathUtils::GetFileNameFromPathWithExt(const Aws::String& path) +{ + if (path.size() == 0) + { + return path; + } + + size_t startPos = path.find_last_of(Aws::FileSystem::PATH_DELIM); + if (startPos == path.size() - 1) + { + return {}; + } + + if (startPos == std::string::npos) + { + startPos = 0; + } + else + { + startPos += 1; + } + + size_t endPos = path.size() - 1; + + return path.substr(startPos, endPos - startPos + 1); } |