2021-10-30 04:25:12 +08:00
|
|
|
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <optional>
|
|
|
|
#include <string>
|
2023-12-02 15:46:57 +08:00
|
|
|
#include <string_view>
|
2021-10-30 04:25:12 +08:00
|
|
|
#include <functional>
|
2021-11-20 00:10:07 +08:00
|
|
|
#include <vector>
|
2021-10-30 04:25:12 +08:00
|
|
|
|
2023-12-02 15:46:57 +08:00
|
|
|
std::optional<std::string> getCurrentWorkingDirectory();
|
|
|
|
|
|
|
|
std::string normalizePath(std::string_view path);
|
|
|
|
std::string resolvePath(std::string_view relativePath, std::string_view baseFilePath);
|
|
|
|
|
2021-10-30 04:25:12 +08:00
|
|
|
std::optional<std::string> readFile(const std::string& name);
|
2022-01-26 00:25:01 +08:00
|
|
|
std::optional<std::string> readStdin();
|
2021-10-30 04:25:12 +08:00
|
|
|
|
2024-11-09 05:41:45 +08:00
|
|
|
bool hasFileExtension(std::string_view name, const std::vector<std::string>& extensions);
|
|
|
|
|
2023-12-02 15:46:57 +08:00
|
|
|
bool isAbsolutePath(std::string_view path);
|
2024-10-05 02:29:55 +08:00
|
|
|
bool isFile(const std::string& path);
|
2021-10-30 04:25:12 +08:00
|
|
|
bool isDirectory(const std::string& path);
|
|
|
|
bool traverseDirectory(const std::string& path, const std::function<void(const std::string& name)>& callback);
|
|
|
|
|
2023-12-02 15:46:57 +08:00
|
|
|
std::vector<std::string_view> splitPath(std::string_view path);
|
2021-10-30 04:25:12 +08:00
|
|
|
std::string joinPaths(const std::string& lhs, const std::string& rhs);
|
|
|
|
std::optional<std::string> getParentPath(const std::string& path);
|
2021-11-20 00:10:07 +08:00
|
|
|
|
|
|
|
std::vector<std::string> getSourceFiles(int argc, char** argv);
|