@@ -10,11 +10,11 @@ namespace Semmle.Extraction.CSharp.DependencyFetching
10
10
/// Used to represent a path to an assembly or a directory containing assemblies
11
11
/// and a selector function to determine which files to include, when indexing the assemblies.
12
12
/// </summary>
13
- internal sealed class AssemblyLookupLocation ( string p , Func < string , bool > includeFileName , bool indexSubdirectories = true )
13
+ internal sealed class AssemblyLookupLocation ( string path , Func < string , bool > includeFileName , bool indexSubdirectories = true )
14
14
{
15
- public string Path => p ;
15
+ public string Path => path ;
16
16
17
- public AssemblyLookupLocation ( string p ) : this ( p , _ => true ) { }
17
+ public AssemblyLookupLocation ( string path ) : this ( path , _ => true ) { }
18
18
19
19
public static implicit operator AssemblyLookupLocation ( string path ) => new ( path ) ;
20
20
@@ -23,15 +23,16 @@ public AssemblyLookupLocation(string p) : this(p, _ => true) { }
23
23
/// and adds them to the a list of assembly names to index.
24
24
/// Indexing is performed at a later stage. This only collects the names.
25
25
/// </summary>
26
- /// <param name="dir">The directory to index.</param>
26
+ /// <param name="dllsToIndex">List of dlls to index.</param>
27
+ /// <param name="logger">Logger.</param>
27
28
private void AddReferenceDirectory ( List < string > dllsToIndex , ILogger logger )
28
29
{
29
30
try
30
31
{
31
- var dlls = new DirectoryInfo ( p ) . EnumerateFiles ( "*.dll" , new EnumerationOptions { RecurseSubdirectories = indexSubdirectories , MatchCasing = MatchCasing . CaseInsensitive , AttributesToSkip = FileAttributes . None } ) ;
32
+ var dlls = new DirectoryInfo ( path ) . EnumerateFiles ( "*.dll" , new EnumerationOptions { RecurseSubdirectories = indexSubdirectories , MatchCasing = MatchCasing . CaseInsensitive , AttributesToSkip = FileAttributes . None } ) ;
32
33
if ( ! dlls . Any ( ) )
33
34
{
34
- logger . LogWarning ( $ "AssemblyLookupLocation: No DLLs found in the path '{ p } '.") ;
35
+ logger . LogWarning ( $ "AssemblyLookupLocation: No DLLs found in the path '{ path } '.") ;
35
36
return ;
36
37
}
37
38
foreach ( var dll in dlls )
@@ -48,47 +49,47 @@ private void AddReferenceDirectory(List<string> dllsToIndex, ILogger logger)
48
49
}
49
50
catch ( Exception e )
50
51
{
51
- logger . LogError ( $ "AssemblyLookupLocation: Error while searching for DLLs in '{ p } ': { e . Message } ") ;
52
+ logger . LogError ( $ "AssemblyLookupLocation: Error while searching for DLLs in '{ path } ': { e . Message } ") ;
52
53
}
53
54
}
54
55
55
56
/// <summary>
56
- /// Returns a list of paths to all assemblies in `p ` that should be indexed.
57
+ /// Returns a list of paths to all assemblies in `path ` that should be indexed.
57
58
/// </summary>
58
59
/// <param name="logger">Logger</param>
59
60
public List < string > GetDlls ( ILogger logger )
60
61
{
61
62
var dllsToIndex = new List < string > ( ) ;
62
- if ( File . Exists ( p ) )
63
+ if ( File . Exists ( path ) )
63
64
{
64
- if ( includeFileName ( System . IO . Path . GetFileName ( p ) ) )
65
+ if ( includeFileName ( System . IO . Path . GetFileName ( path ) ) )
65
66
{
66
- dllsToIndex . Add ( p ) ;
67
+ dllsToIndex . Add ( path ) ;
67
68
}
68
69
else
69
70
{
70
- logger . LogInfo ( $ "AssemblyLookupLocation: Skipping { p } .") ;
71
+ logger . LogInfo ( $ "AssemblyLookupLocation: Skipping { path } .") ;
71
72
}
72
73
return dllsToIndex ;
73
74
}
74
75
75
- if ( Directory . Exists ( p ) )
76
+ if ( Directory . Exists ( path ) )
76
77
{
77
- logger . LogInfo ( $ "AssemblyLookupLocation: Finding reference DLLs in { p } ...") ;
78
+ logger . LogInfo ( $ "AssemblyLookupLocation: Finding reference DLLs in { path } ...") ;
78
79
AddReferenceDirectory ( dllsToIndex , logger ) ;
79
80
}
80
81
else
81
82
{
82
- logger . LogInfo ( "AssemblyLookupLocation: Path not found: " + p ) ;
83
+ logger . LogInfo ( "AssemblyLookupLocation: Path not found: " + path ) ;
83
84
}
84
85
return dllsToIndex ;
85
86
}
86
87
87
88
public override bool Equals ( object ? obj ) =>
88
- obj is AssemblyLookupLocation ap && p . Equals ( ap . Path ) ;
89
+ obj is AssemblyLookupLocation ap && path . Equals ( ap . Path ) ;
89
90
90
- public override int GetHashCode ( ) => p . GetHashCode ( ) ;
91
+ public override int GetHashCode ( ) => path . GetHashCode ( ) ;
91
92
92
- public override string ToString ( ) => p ;
93
+ public override string ToString ( ) => path ;
93
94
}
94
95
}
0 commit comments