mirror of
https://github.com/luau-lang/luau.git
synced 2025-01-10 05:19:10 +00:00
8f94786ceb
Some checks failed
benchmark / callgrind (map[branch:main name:luau-lang/benchmark-data], ubuntu-22.04) (push) Has been cancelled
build / macos (push) Has been cancelled
build / macos-arm (push) Has been cancelled
build / ubuntu (push) Has been cancelled
build / windows (Win32) (push) Has been cancelled
build / windows (x64) (push) Has been cancelled
build / coverage (push) Has been cancelled
build / web (push) Has been cancelled
release / macos (push) Has been cancelled
release / ubuntu (push) Has been cancelled
release / windows (push) Has been cancelled
release / web (push) Has been cancelled
This PR refactors the CLI folder to use the same project split between include and src directories that we have for all the other artifacts in luau. It also includes the require-by-string implementation we already have as a feature of `Luau.CLI.lib`. Both of these changes are targeted at making it easier for embedding projects to setup an effective equivalent to the standalone `luau` executable with whatever runtime libraries they need attached and without having to unnecessarily duplicate code from luau itself.
29 lines
1.1 KiB
C++
29 lines
1.1 KiB
C++
// 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>
|
|
#include <string_view>
|
|
#include <functional>
|
|
#include <vector>
|
|
|
|
std::optional<std::string> getCurrentWorkingDirectory();
|
|
|
|
std::string normalizePath(std::string_view path);
|
|
std::string resolvePath(std::string_view relativePath, std::string_view baseFilePath);
|
|
|
|
std::optional<std::string> readFile(const std::string& name);
|
|
std::optional<std::string> readStdin();
|
|
|
|
bool hasFileExtension(std::string_view name, const std::vector<std::string>& extensions);
|
|
|
|
bool isAbsolutePath(std::string_view path);
|
|
bool isFile(const std::string& path);
|
|
bool isDirectory(const std::string& path);
|
|
bool traverseDirectory(const std::string& path, const std::function<void(const std::string& name)>& callback);
|
|
|
|
std::vector<std::string_view> splitPath(std::string_view path);
|
|
std::string joinPaths(const std::string& lhs, const std::string& rhs);
|
|
std::optional<std::string> getParentPath(const std::string& path);
|
|
|
|
std::vector<std::string> getSourceFiles(int argc, char** argv);
|