Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,37 +0,0 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Test_Common_Path is
|
||||
function "rem" (A, B : String) return String is
|
||||
Slash : Integer := A'First; -- At the last slash seen in A
|
||||
At_A : Integer := A'first;
|
||||
At_B : Integer := B'first;
|
||||
begin
|
||||
loop
|
||||
if At_A > A'Last then
|
||||
if At_B > B'Last or else B (At_B) = '/' then
|
||||
return A;
|
||||
else
|
||||
return A (A'First..Slash - 1);
|
||||
end if;
|
||||
elsif At_B > B'Last then
|
||||
if A (At_A) = '/' then -- A cannot be shorter than B here
|
||||
return B;
|
||||
else
|
||||
return A (A'First..Slash - 1);
|
||||
end if;
|
||||
elsif A (At_A) /= B (At_B) then
|
||||
return A (A'First..Slash - 1);
|
||||
elsif A (At_A) = '/' then
|
||||
Slash := At_A;
|
||||
end if;
|
||||
At_A := At_A + 1;
|
||||
At_B := At_B + 1;
|
||||
end loop;
|
||||
end "rem";
|
||||
begin
|
||||
Put_Line
|
||||
( "/home/user1/tmp/coverage/test" rem
|
||||
"/home/user1/tmp/covert/operator" rem
|
||||
"/home/user1/tmp/coven/members"
|
||||
);
|
||||
end Test_Common_Path;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
commonPathPrefix: function [lst][
|
||||
paths: map lst => [split.by:"/" &]
|
||||
|
||||
common: new []
|
||||
common: []
|
||||
firstPath: first paths
|
||||
loop .with:'i firstPath 'part [
|
||||
found: true
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
<#
|
||||
.Synopsis
|
||||
Finds the deepest common directory path of files passed through the pipeline.
|
||||
.Parameter File
|
||||
PowerShell file object.
|
||||
#>
|
||||
function Get-CommonPath {
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(Mandatory=$true, ValueFromPipeline=$true)]
|
||||
[System.IO.FileInfo] $File
|
||||
)
|
||||
process {
|
||||
# Get the current file's path list
|
||||
$PathList = $File.FullName -split "\$([IO.Path]::DirectorySeparatorChar)"
|
||||
# Get the most common path list
|
||||
if ($CommonPathList) {
|
||||
$CommonPathList = (Compare-Object -ReferenceObject $CommonPathList -DifferenceObject $PathList -IncludeEqual `
|
||||
-ExcludeDifferent -SyncWindow 0).InputObject
|
||||
} else {
|
||||
$CommonPathList = $PathList
|
||||
}
|
||||
}
|
||||
end {
|
||||
$CommonPathList -join [IO.Path]::DirectorySeparatorChar
|
||||
}
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
"C:\a\b\c\d\e","C:\a\b\e\f","C:\a\b\c\d\x" | Get-CommonPath
|
||||
C:\a\b
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
' Read the list of paths (newline-separated) into an array...
|
||||
strPaths = Split(WScript.StdIn.ReadAll, vbCrLf)
|
||||
|
||||
' Split each path by the delimiter (/)...
|
||||
For i = 0 To UBound(strPaths)
|
||||
strPaths(i) = Split(strPaths(i), "/")
|
||||
Next
|
||||
|
||||
With CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
' Test each path segment...
|
||||
For j = 0 To UBound(strPaths(0))
|
||||
|
||||
' Test each successive path against the first...
|
||||
For i = 1 To UBound(strPaths)
|
||||
If strPaths(0)(j) <> strPaths(i)(j) Then Exit For
|
||||
Next
|
||||
|
||||
' If we didn't make it all the way through, exit the block...
|
||||
If i <= UBound(strPaths) Then Exit For
|
||||
|
||||
' Make sure this path exists...
|
||||
If Not .FolderExists(strPath & strPaths(0)(j) & "/") Then Exit For
|
||||
strPath = strPath & strPaths(0)(j) & "/"
|
||||
|
||||
Next
|
||||
|
||||
End With
|
||||
|
||||
' Remove the final "/"...
|
||||
WScript.Echo Left(strPath, Len(strPath) - 1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue