Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Roblox
GitHub Repository: Roblox/luau
Path: blob/master/CLI/include/Luau/FileUtils.h
2727 views
1
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
2
#pragma once
3
4
#include <optional>
5
#include <string>
6
#include <string_view>
7
#include <functional>
8
#include <vector>
9
10
std::optional<std::string> getCurrentWorkingDirectory();
11
12
std::string normalizePath(std::string_view path);
13
std::optional<std::string> resolvePath(std::string_view relativePath, std::string_view baseFilePath);
14
15
std::optional<std::string> readFile(const std::string& name);
16
std::optional<std::string> readStdin();
17
18
bool hasFileExtension(std::string_view name, const std::vector<std::string>& extensions);
19
20
bool isAbsolutePath(std::string_view path);
21
bool isFile(const std::string& path);
22
bool isDirectory(const std::string& path);
23
bool traverseDirectory(const std::string& path, const std::function<void(const std::string& name)>& callback);
24
25
std::vector<std::string_view> splitPath(std::string_view path);
26
std::string joinPaths(std::string_view lhs, std::string_view rhs);
27
std::optional<std::string> getParentPath(std::string_view path);
28
29
std::vector<std::string> getSourceFiles(int argc, char** argv);
30
31