@@ -19,7 +19,7 @@ public PackageCompilationAssemblyResolver()
1919 }
2020
2121 public PackageCompilationAssemblyResolver ( string nugetPackageDirectory )
22- : this ( FileSystemWrapper . Default , new string [ ] { nugetPackageDirectory } )
22+ : this ( FileSystemWrapper . Default , [ nugetPackageDirectory ] )
2323 {
2424 }
2525
@@ -46,32 +46,24 @@ internal static string[] GetDefaultProbeDirectories(IEnvironment environment)
4646
4747 if ( ! string . IsNullOrEmpty ( listOfDirectories ) )
4848 {
49- return listOfDirectories . Split ( new char [ ] { Path . PathSeparator } , StringSplitOptions . RemoveEmptyEntries ) ;
49+ return listOfDirectories . Split ( [ Path . PathSeparator ] , StringSplitOptions . RemoveEmptyEntries ) ;
5050 }
5151
5252 string ? packageDirectory = environment . GetEnvironmentVariable ( "NUGET_PACKAGES" ) ;
5353
5454 if ( ! string . IsNullOrEmpty ( packageDirectory ) )
5555 {
56- return new string [ ] { packageDirectory } ;
56+ return [ packageDirectory ] ;
5757 }
5858
59- string ? basePath ;
60- if ( environment . IsWindows ( ) )
61- {
62- basePath = environment . GetEnvironmentVariable ( "USERPROFILE" ) ;
63- }
64- else
65- {
66- basePath = environment . GetEnvironmentVariable ( "HOME" ) ;
67- }
59+ string basePath = Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) ;
6860
6961 if ( string . IsNullOrEmpty ( basePath ) )
7062 {
71- return new string [ ] { string . Empty } ;
63+ return [ string . Empty ] ;
7264 }
7365
74- return new string [ ] { Path . Combine ( basePath , ".nuget" , "packages" ) } ;
66+ return [ Path . Combine ( basePath , ".nuget" , "packages" ) ] ;
7567 }
7668
7769 public bool TryResolveAssemblyPaths ( CompilationLibrary library , List < string > ? assemblies )
@@ -102,7 +94,7 @@ public bool TryResolveAssemblyPaths(CompilationLibrary library, List<string>? as
10294
10395 private static bool TryResolveFromPackagePath ( IFileSystem fileSystem , CompilationLibrary library , string basePath , [ MaybeNullWhen ( false ) ] out IEnumerable < string > results )
10496 {
105- var paths = new List < string > ( ) ;
97+ List < string > paths = [ ] ;
10698
10799 foreach ( string assembly in library . Assemblies )
108100 {
0 commit comments