summaryrefslogtreecommitdiff
path: root/tools/normalize-3rd-path.lua
blob: 9a9194cf96e1d5d616a489175308fc188cfc7720 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
local fs  = require 'bee.filesystem'
local fsu = require 'fs-utility'

local thirdPath = fs.path 'meta/3rd'

for dir in fs.pairs(thirdPath) do
    local libraryPath = dir / 'library'
    if fs.is_directory(libraryPath) then
        fsu.scanDirectory(libraryPath, function (fullPath)
            if fullPath:stem():string():find '%.' then
                local newPath = fullPath:parent_path() / (fullPath:stem():string():gsub('%.', '/') .. '.lua')
                fs.create_directories(newPath:parent_path())
                fs.rename(fullPath, newPath)
            end
        end)
    end
end