Android-cuttlefish cvd tool
filesystem.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 The Android Open Source Project
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#pragma once
18
20
21#include <string>
22
24
25// TODO(b/175635923): remove after enabling libc++fs for windows
26const char kPathSeparator =
27#ifdef _WIN32
28 '\\';
29#else
30 '/';
31#endif
32
33std::string GetHomeDirPath();
34bool FileExists(const std::string& path);
35bool EnsureDirectoryExists(const std::string& directory_path);
36
37class FileLock {
38 public:
39 FileLock() = delete;
40 FileLock(const std::string& path);
41
42 private:
44};
Definition: filesystem.h:37
FileLock()=delete
unique_fd fd_
Definition: filesystem.h:43
Definition: unique_fd.h:61
bool FileExists(const std::string &path)
Definition: filesystem.cpp:86
const char kPathSeparator
Definition: filesystem.h:26
bool EnsureDirectoryExists(const std::string &directory_path)
Definition: filesystem.cpp:90
std::string GetHomeDirPath()
Definition: filesystem.cpp:53