mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-01 15:26:59 +00:00
Lua: Add FS.GetParentFolder
This commit is contained in:
parent
908f67a799
commit
23ffa25d78
@ -30,6 +30,7 @@ namespace FS {
|
||||
std::pair<bool, std::string> Copy(const std::string& Path, const std::string& NewPath);
|
||||
std::string GetFilename(const std::string& Path);
|
||||
std::string GetExtension(const std::string& Path);
|
||||
std::string GetParentFolder(const std::string& Path);
|
||||
bool Exists(const std::string& Path);
|
||||
}
|
||||
}
|
||||
|
@ -319,3 +319,7 @@ std::string LuaAPI::FS::GetFilename(const std::string& Path) {
|
||||
std::string LuaAPI::FS::GetExtension(const std::string& Path) {
|
||||
return fs::path(Path).extension().string();
|
||||
}
|
||||
|
||||
std::string LuaAPI::FS::GetParentFolder(const std::string& Path) {
|
||||
return fs::relative(Path).parent_path().string();
|
||||
}
|
||||
|
@ -457,6 +457,7 @@ TLuaEngine::StateThreadData::StateThreadData(const std::string& Name, std::atomi
|
||||
FSTable.set_function("Copy", &LuaAPI::FS::Copy);
|
||||
FSTable.set_function("GetFilename", &LuaAPI::FS::GetFilename);
|
||||
FSTable.set_function("GetExtension", &LuaAPI::FS::GetExtension);
|
||||
FSTable.set_function("GetParentFolder", &LuaAPI::FS::GetParentFolder);
|
||||
Start();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user