Compare commits
No commits in common. "24af2b56e0fb0bd4ea340e17c8535b43ab7897bb" and "f5d288f64bff1739b79f99e2accdf0aa7886af4a" have entirely different histories.
24af2b56e0
...
f5d288f64b
|
|
@ -1,7 +1,5 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local Extension_Map = require"SpecSwitcher.ExtensionMap"
|
|
||||||
|
|
||||||
local Config = {
|
local Config = {
|
||||||
test = "hallo"
|
test = "hallo"
|
||||||
}
|
}
|
||||||
|
|
@ -17,7 +15,7 @@ function M.setup(opts)
|
||||||
Config[k] = v
|
Config[k] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
local mapping = Extension_Map:new()
|
local mapping = require("ExtensionMap"):new()
|
||||||
|
|
||||||
mapping:add("c", {"h", "H", "hh", "HH"})
|
mapping:add("c", {"h", "H", "hh", "HH"})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,50 +91,8 @@ function path.Get_Ext( P, Extension_List )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function path.Walk_Up( P )
|
|
||||||
if P == "/" then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
local rev = string.reverse(P)
|
|
||||||
local start = 1
|
|
||||||
if P:sub(-1) == "/" then
|
|
||||||
start = start + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
local slash_first_idx, _ = string.find(rev, "/", start, true)
|
|
||||||
|
|
||||||
return string.sub(P, 1, #P - slash_first_idx + 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
function path.Generate_Dir_Walk( Base, Descend_List )
|
|
||||||
local Descend_Length = #Descend_List
|
|
||||||
|
|
||||||
local i = -1
|
|
||||||
local Base_Dir = Base
|
|
||||||
function Inner()
|
|
||||||
if i == Descend_Length then
|
|
||||||
local Temp_Dir = path.Walk_Up(Base_Dir)
|
|
||||||
if Temp_Dir ~= nil then
|
|
||||||
Base_Dir = Temp_Dir
|
|
||||||
i = -1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
i = i + 1
|
|
||||||
if i == 0 then
|
|
||||||
return Base_Dir
|
|
||||||
elseif i <= Descend_Length then
|
|
||||||
return Base_Dir .. Descend_List[i]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return Inner
|
|
||||||
end
|
|
||||||
|
|
||||||
print(path.Common_Root("/home/folkert/Documents/Projects","/home/folkert/Downloads/sub/sub2/sub3/sub4/hello.txt"))
|
print(path.Common_Root("/home/folkert/Documents/Projects","/home/folkert/Downloads/sub/sub2/sub3/sub4/hello.txt"))
|
||||||
print(path.Get_Ext("/home/folkert/Documents/projects.wo.cp", {"o.cp"}))
|
print(path.Get_Ext("/home/folkert/Documents/projects.wo.cp", {"o.cp"}))
|
||||||
|
|
||||||
for x in path.Generate_Dir_Walk("/home/folkert/", {"include", "src"}) do
|
|
||||||
print(x)
|
|
||||||
end
|
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user