mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Lua - GetAbsolutePath, GetRelativePath functions (#382)
(cherry picked from commit c265df60f0)
This commit is contained in:
parent
f6e09040e3
commit
b12ae242ab
1 changed files with 24 additions and 1 deletions
|
|
@ -39,7 +39,7 @@ uses
|
|||
Forms, Dialogs, Clipbrd, LazUTF8, LCLVersion, uLng, DCOSUtils,
|
||||
DCConvertEncoding, fMain, uFormCommands, uOSUtils, uGlobs, uLog,
|
||||
uClipboard, uShowMsg, uLuaStd, uFindEx, uConvEncoding, uFileProcs,
|
||||
uFilePanelSelect, uMasks;
|
||||
uFilePanelSelect, uMasks, LazFileUtils;
|
||||
|
||||
procedure luaPushSearchRec(L : Plua_State; Rec: PSearchRecEx);
|
||||
begin
|
||||
|
|
@ -240,6 +240,26 @@ begin
|
|||
lua_pushstring(L, ExtractFileDir(lua_tostring(L, 1)));
|
||||
end;
|
||||
|
||||
function luaGetAbsolutePath(L : Plua_State) : Integer; cdecl;
|
||||
var
|
||||
FileName, BaseDir: String;
|
||||
begin
|
||||
Result:= 1;
|
||||
FileName:= lua_tostring(L, 1);
|
||||
BaseDir:= lua_tostring(L, 2);
|
||||
lua_pushstring(L, CreateAbsolutePath(FileName, BaseDir));
|
||||
end;
|
||||
|
||||
function luaGetRelativePath(L : Plua_State) : Integer; cdecl;
|
||||
var
|
||||
FileName, BaseDir: String;
|
||||
begin
|
||||
Result:= 1;
|
||||
FileName:= lua_tostring(L, 1);
|
||||
BaseDir:= lua_tostring(L, 2);
|
||||
lua_pushstring(L, CreateRelativePath(FileName, BaseDir));
|
||||
end;
|
||||
|
||||
function luaPos(L : Plua_State) : Integer; cdecl;
|
||||
var
|
||||
Offset: SizeInt = 1;
|
||||
|
|
@ -485,6 +505,9 @@ begin
|
|||
luaP_register(L, 'ExtractFileName', @luaExtractFileName);
|
||||
luaP_register(L, 'ExtractFileDrive', @luaExtractFileDrive);
|
||||
|
||||
luaP_register(L, 'GetAbsolutePath', @luaGetAbsolutePath);
|
||||
luaP_register(L, 'GetRelativePath', @luaGetRelativePath);
|
||||
|
||||
luaP_register(L, 'MatchesMask', @luaMatchesMask);
|
||||
luaP_register(L, 'MatchesMaskList', @luaMatchesMaskList);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue