diff options
Diffstat (limited to 'wearable_src/Filesystem/PathUtils.cpp')
-rwxr-xr-x | wearable_src/Filesystem/PathUtils.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/wearable_src/Filesystem/PathUtils.cpp b/wearable_src/Filesystem/PathUtils.cpp new file mode 100755 index 0000000..b6f47a0 --- /dev/null +++ b/wearable_src/Filesystem/PathUtils.cpp @@ -0,0 +1,38 @@ +// +// Tizen Web Device API +// Copyright (c) 2012 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +#include "PathUtils.h" +#include <Logger.h> +namespace DeviceAPI { +namespace Filesystem { +namespace PathUtils { +PathList getParts(const IPathPtr& path) +{ + PathList result; + IPath::SeparatorType separator = path->getSeparator(); + std::string fullPath = path->getFullPath(); + std::string::size_type pos = 0; + while ((pos = fullPath.find(separator, pos + 1)) != std::string::npos) { + if (pos == fullPath.length()- 1) + break; + result.push_back(IPath::create(fullPath.substr(0, pos))); + } + return result; +} +} // PathUtils +} // Filesystem +} // TizenApis |