September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -0,0 +1,22 @@
|
|||
function common_directory_path(sequence paths, integer sep='/')
|
||||
sequence res = {}
|
||||
if length(paths) then
|
||||
res = split(paths[1],sep)[1..-2]
|
||||
for i=2 to length(paths) do
|
||||
sequence pi = split(paths[i],sep)[1..-2]
|
||||
for j=1 to length(res) do
|
||||
if j>length(pi) or res[j]!=pi[j] then
|
||||
res = res[1..j-1]
|
||||
exit
|
||||
end if
|
||||
end for
|
||||
if length(res)=0 then exit end if
|
||||
end for
|
||||
end if
|
||||
return join(res,sep)
|
||||
end function
|
||||
|
||||
constant test = {"/home/user1/tmp/coverage/test",
|
||||
"/home/user1/tmp/covert/operator",
|
||||
"/home/user1/tmp/coven/members"}
|
||||
?common_directory_path(test)
|
||||
Loading…
Add table
Add a link
Reference in a new issue