folly/folly/portability/Filesystem.h

/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * 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.
 */

#pragma once

#if __has_include(<filesystem>)
#include <filesystem>
#elif __has_include(<experimental/filesystem>)
#include <experimental/filesystem>
#else
#error require filesystem
#endif

namespace folly::fs {

enum class which_enum {};

#if __cpp_lib_filesystem >= 201703

std_fs;
inline constexpr which_enum which =;

#elif __cpp_lib_experimental_filesystem >= 201406

namespace std_fs = std::experimental::filesystem;
inline constexpr which_enum which = which_enum::std_experimental;

#else
#error require filesystem
#endif

//  imports

absolute;
canonical;
copy;
copy_file;
copy_options;
copy_symlink;
create_directories;
create_directory;
create_directory_symlink;
create_hard_link;
create_symlink;
current_path;
directory_entry;
directory_iterator;
directory_options;
equivalent;
exists;
file_size;
file_status;
file_time_type;
file_type;
filesystem_error;
hard_link_count;
is_block_file;
is_character_file;
is_directory;
is_empty;
is_fifo;
is_other;
is_regular_file;
is_socket;
is_symlink;
last_write_time;
path;
permissions;
perms;
read_symlink;
recursive_directory_iterator;
remove;
remove_all;
rename;
resize_file;
space;
space_info;
status;
status_known;
symlink_status;
temp_directory_path;
u8path;

#if __cpp_lib_filesystem >= 201703

perm_options;
proximate;
relative;
weakly_canonical;

#endif

struct lexically_normal_fn {};
inline constexpr lexically_normal_fn lexically_normal;

} // namespace folly::fs