-
Notifications
You must be signed in to change notification settings - Fork 24
/
caseduplwdx.lua
35 lines (32 loc) · 1.23 KB
/
caseduplwdx.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
-- dc >= r8316
local dupl_found = "Yes"
local dupl_notfound = "-"
function ContentGetSupportedField(FieldIndex)
if (FieldIndex == 0) then
return "case duplicates", dupl_found .. '|' .. dupl_notfound, 7;
end
return '', '', 0; -- ft_nomorefields
end
function ContentGetValue(FileName, FieldIndex, UnitIndex, flags)
if (FieldIndex == 0) then
local IsFound = dupl_notfound;
if (FileName:find("[" .. SysUtils.PathDelim .. "]%.%.$")) then
return nil;
end
local CurrentName = FileName:match("[" .. SysUtils.PathDelim .. "]([^" .. SysUtils.PathDelim .. "]+)$");
local CurrentPath = FileName:match("(.*[" .. SysUtils.PathDelim .. "])");
local Handle, FindData = SysUtils.FindFirst(CurrentPath .. "*");
if (Handle ~= nil) then
repeat
if (FindData.Name ~= CurrentName) and (LazUtf8.LowerCase(CurrentName) == LazUtf8.LowerCase(FindData.Name)) then
IsFound = dupl_found;
break;
end
Result, FindData = SysUtils.FindNext(Handle)
until (Result == nil)
SysUtils.FindClose(Handle)
return IsFound;
end
end
return nil; -- invalid
end