ONE - On-device Neural Engine
Loading...
Searching...
No Matches
filesystem_linux.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#include <sys/stat.h>
20#include <dirent.h>
21
22namespace filesystem
23{
24
25const std::string separator() { return "/"; }
26
27std::string normalize_path(const std::string &path)
28{
29 // DO NOTHING
30 return path;
31}
32
33bool is_dir(const std::string &path)
34{
35 DIR *dir = opendir(path.c_str());
36 if (dir)
37 {
38 closedir(dir);
39 return true;
40 }
41 return false;
42}
43
44bool mkdir(const std::string &path) { return ::mkdir(path.c_str(), 0775) == 0; }
45
46} // namespace filesystem
bool mkdir(const std::string &path)
bool is_dir(const std::string &path)
const std::string separator()
std::string normalize_path(const std::string &path)
Normalize compatible separator in path to default separator.