-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathmarkerwdx.lua
More file actions
66 lines (60 loc) · 1.49 KB
/
markerwdx.lua
File metadata and controls
66 lines (60 loc) · 1.49 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
-- markerwdx.lua (cross-platform)
-- 2022.12.07
local dbn
local c = 0
local fl = {}
function ContentGetSupportedField(FieldIndex)
if FieldIndex == 0 then
return "Color", "", 8
end
return "", "", 0
end
function ContentGetDefaultSortOrder(FieldIndex)
return 1; --or -1
end
function ContentGetDetectString()
return 'EXT="*"'
end
function ContentGetValue(FileName, FieldIndex, UnitIndex, flags)
if flags == 1 then return nil end; -- Исключаем вывод для диалога свойств (CONTENT_DELAYIFSLOW)
if FieldIndex ~= 0 then return nil end
local at = SysUtils.FileGetAttr(FileName)
if (at < 0) or (math.floor(at / 0x00000010) % 2 ~= 0) then return nil end
if dbn == nil then
local sn = debug.getinfo(1).source
if string.sub(sn, 1, 1) == '@' then sn = string.sub(sn, 2, -1) end
dbn = SysUtils.ExtractFilePath(sn) .. 'marker.txt'
end
if #fl == 0 then
ReadFileList()
else
if os.getenv('MarkerDB') == 'Read' then
ReadFileList()
os.setenv('MarkerDB', 'Done')
end
end
if c > 0 then
local n, s
for i = 1, c do
n = string.find(fl[i], '|', 1, true)
if n == nil then break end
s = string.sub(fl[i], 1, n - 1)
if s == FileName then return string.sub(fl[i], n + 1, -1) end
end
end
return nil
end
function ReadFileList()
local h = io.open(dbn, 'r')
if h == nil then
c = 0
else
c = 1
for l in h:lines() do
fl[c] = l
c = c + 1
end
h:close()
c = c - 1
end
end