Detecting addon folder name (folder that an addon is in)?

Is there a way to detect the name of an addon folder?

Yes

[lua]
for k,v in pairs(file.FindDir("…/addons/")) do
print(k,v)
end
for k,v in pairs(file.FindDir("…/addons/
")) do
if v == “counter-strike” then
print(true)
end
end
[/lua]

Top one

bottom one

You can get addon folder name of executed file with
[lua]string.match(debug.getinfo(1, “S”).short_src, “%\(%w+)%\”)[/lua]

Pecius’s solution looks like what I was looking for. Thanks.