mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Lua - ExtractFile* functions
This commit is contained in:
parent
0e05c006f7
commit
407d4d4b0d
1 changed files with 37 additions and 0 deletions
|
|
@ -134,6 +134,36 @@ begin
|
|||
lua_pushboolean(L, mbDirectoryExists(lua_tostring(L, 1)));
|
||||
end;
|
||||
|
||||
function luaExtractFilePath(L : Plua_State) : Integer; cdecl;
|
||||
begin
|
||||
Result:= 1;
|
||||
lua_pushstring(L, ExtractFilePath(lua_tostring(L, 1)));
|
||||
end;
|
||||
|
||||
function luaExtractFileDrive(L : Plua_State) : Integer; cdecl;
|
||||
begin
|
||||
Result:= 1;
|
||||
lua_pushstring(L, ExtractFileDrive(lua_tostring(L, 1)));
|
||||
end;
|
||||
|
||||
function luaExtractFileName(L : Plua_State) : Integer; cdecl;
|
||||
begin
|
||||
Result:= 1;
|
||||
lua_pushstring(L, ExtractFileName(lua_tostring(L, 1)));
|
||||
end;
|
||||
|
||||
function luaExtractFileExt(L : Plua_State) : Integer; cdecl;
|
||||
begin
|
||||
Result:= 1;
|
||||
lua_pushstring(L, ExtractFileExt(lua_tostring(L, 1)));
|
||||
end;
|
||||
|
||||
function luaExtractFileDir(L : Plua_State) : Integer; cdecl;
|
||||
begin
|
||||
Result:= 1;
|
||||
lua_pushstring(L, ExtractFileDir(lua_tostring(L, 1)));
|
||||
end;
|
||||
|
||||
function luaPos(L : Plua_State) : Integer; cdecl;
|
||||
var
|
||||
Offset: SizeInt = 1;
|
||||
|
|
@ -358,6 +388,13 @@ begin
|
|||
luaP_register(L, 'FileGetAttr', @luaFileGetAttr);
|
||||
luaP_register(L, 'GetTickCount', @luaGetTickCount);
|
||||
luaP_register(L, 'DirectoryExists', @luaDirectoryExists);
|
||||
|
||||
luaP_register(L, 'ExtractFileExt', @luaExtractFileExt);
|
||||
luaP_register(L, 'ExtractFileDir', @luaExtractFileDir);
|
||||
luaP_register(L, 'ExtractFilePath', @luaExtractFilePath);
|
||||
luaP_register(L, 'ExtractFileName', @luaExtractFileName);
|
||||
luaP_register(L, 'ExtractFileDrive', @luaExtractFileDrive);
|
||||
|
||||
luaC_register(L, 'PathDelim', PathDelim);
|
||||
lua_setglobal(L, 'SysUtils');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue