ONE - On-device Neural Engine
Loading...
Searching...
No Matches
filesystem_common.cpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#include "
filesystem.h
"
18
19
namespace
filesystem
20
{
21
22
std::string
join
(
const
std::string &path1,
const
std::string &path2)
23
{
24
// TODO check path1 does not end with separator
25
// TODO check path2 does not start with separator
26
return
path1 +
separator
() + path2;
27
}
28
29
std::string
basename
(
const
std::string &path)
30
{
31
auto
last_index = path.find_last_of(
separator
());
32
33
// No separator
34
if
(last_index == std::string::npos)
35
return
path;
36
37
// Trailing separator
38
if
(last_index +
separator
().
size
() == path.size())
39
return
basename
(path.substr(0, last_index));
40
41
return
path.substr(last_index +
separator
().
size
());
42
}
43
44
}
// namespace filesystem
filesystem.h
filesystem
Definition
filesystem.h:25
filesystem::join
std::string join(const std::string &path1, const std::string &path2)
Definition
filesystem_common.cpp:22
filesystem::separator
const std::string separator()
Definition
filesystem_linux.cpp:25
filesystem::basename
std::string basename(const std::string &path)
Definition
filesystem_common.cpp:29
size
int32_t size[5]
Definition
Slice.cpp:35
compiler
tf2nnpkg
src
filesystem_common.cpp
Generated by
1.9.8