MH
Size: a a a
MH
RS
local path = 'folder/abc/file.jpg'
local separator = package.config:sub(1, 1)
local result = path:match('(.*' .. separator .. ')')
print(result) -- folder/abc/
S
local path = 'folder/abc/file.jpg'
local separator = package.config:sub(1, 1)
local result = path:match('(.*' .. separator .. ')')
print(result) -- folder/abc/
package.config
— хороший тон.зк
local params = {...}
local TempDir = "tmppp/"
SysUtils.CreateDirectory(TempDir)
DC.ExecuteCommand("cm_ChangeDir", "inactivepath=%D/" .. TempDir)
-- выделить только файлы изоражений
DC.ExecuteCommand("cm_MarkPlus", "mask=*.bmp;*.jpg;*.jpeg;*.svg;*.ico;*.gif;*.png;*.tiff;*.tif;*.webp;*.svg;*.svgz;*.xcf;", "attr=d-", "casesensitive=0");
DC.ExecuteCommand("cm_MarkPlus", "mask=*.", "attr=d-", "casesensitive=0");
DC.ExecuteCommand("cm_MarkMinus", "mask=\.*");
DC.ExecuteCommand("cm_RenameNoAsk", "confirmation=no", "queueid=1");
DC.ExecuteCommand("cm_FocusSwap");
DC.ExecuteCommand("cm_MarkMarkAll");
DC.ExecuteCommand("cm_ExecuteScript", "$DC_CONFIG_PATH/scripts/autorename.lua", "%LU", "1", "-1", "image. large", "");
-- здесь скрипт пытается выполнить следующую команду (cm_MarkMarkAll) не успев выполнить переименование
DC.ExecuteCommand("cm_MarkMarkAll");
DC.ExecuteCommand("cm_RenameNoAsk", "confirmation=no", "queueid=2");
DC.ExecuteCommand("cm_FocusSwap");
-- здесь скрипт пытается удалить каталог не успев выполнить перемещение
local br, es, en
local h, d = SysUtils.FindFirst(TempDir .. SysUtils.PathDelim .. '*')
if h == nil then
br, es, en = os.remove(TempDir)
if br == nil then
Dialogs.MessageBox('Error: ' .. en .. '\n' .. es, 'Delete folder', 0x0040)
end
else
SysUtils.FindClose(h)
br = Dialogs.MessageBox('Temporary folder is not empty!\nDo you want to delete anyway?', 'Delete folder', 0x0001 + 0x0030)
if br == 0x0001 then
br, es, en = os.remove(TempDir)
if br == nil then
Dialogs.MessageBox('Error: ' .. en .. '\n' .. es, 'Delete folder', 0x0040)
end
end
end
S
зк
S
зк
S
зк
зк
MH
S
зк
S