@@ -23,11 +23,12 @@ public static class Common
2323
2424 private static readonly Lazy < string > AppStatePathLazy = new ( ( ) =>
2525 {
26- string path = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) , ".wingetcreate" ) ;
2726#if WINDOWS
28- path = IsRunningAsUwp ( )
27+ string path = IsRunningAsUwp ( )
2928 ? ApplicationData . Current . LocalFolder . Path
3029 : Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . LocalApplicationData ) , "Microsoft" , ModuleName ) ;
30+ #else
31+ string path = Path . Combine ( Environment . GetFolderPath ( Environment . SpecialFolder . UserProfile ) , ".wingetcreate" ) ;
3132#endif
3233 Directory . CreateDirectory ( path ) ;
3334 return path ;
@@ -90,19 +91,28 @@ public static string GetPathForDisplay(string path, bool substituteEnvironmentVa
9091
9192 path = Path . GetFullPath ( path ) ;
9293
93- if ( path . StartsWith ( tempPath , StringComparison . OrdinalIgnoreCase ) && RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
94- {
95- return path . Replace ( tempPath , TempEnvironmentVariable , StringComparison . OrdinalIgnoreCase ) ;
96- }
97- else if ( path . StartsWith ( localAppDataPath , StringComparison . OrdinalIgnoreCase ) && RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
94+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
9895 {
99- return path . Replace ( localAppDataPath , LocalAppDataEnvironmentVariable , StringComparison . OrdinalIgnoreCase ) ;
96+ if ( path . StartsWith ( tempPath , StringComparison . OrdinalIgnoreCase ) )
97+ {
98+ return path . Replace ( tempPath , TempEnvironmentVariable , StringComparison . OrdinalIgnoreCase ) ;
99+ }
100+ else if ( path . StartsWith ( localAppDataPath , StringComparison . OrdinalIgnoreCase ) )
101+ {
102+ return path . Replace ( localAppDataPath , LocalAppDataEnvironmentVariable , StringComparison . OrdinalIgnoreCase ) ;
103+ }
104+ else if ( path . StartsWith ( userProfilePath , StringComparison . OrdinalIgnoreCase ) )
105+ {
106+ return path . Replace ( userProfilePath , UserProfileEnvironmentVariable , StringComparison . OrdinalIgnoreCase ) ;
107+ }
100108 }
101- else if ( path . StartsWith ( userProfilePath , StringComparison . OrdinalIgnoreCase ) && ! path . StartsWith ( localAppDataPath , StringComparison . OrdinalIgnoreCase ) )
109+ else
102110 {
103- return RuntimeInformation . IsOSPlatform ( OSPlatform . Windows )
104- ? path . Replace ( userProfilePath , UserProfileEnvironmentVariable , StringComparison . OrdinalIgnoreCase )
105- : path . Replace ( userProfilePath , UserHomeDirectoryShortcutUnix , StringComparison . OrdinalIgnoreCase ) ;
111+ // Paths are case-sensitive on Unix
112+ if ( path . StartsWith ( userProfilePath , StringComparison . Ordinal ) )
113+ {
114+ return path . Replace ( userProfilePath , UserHomeDirectoryShortcutUnix , StringComparison . Ordinal ) ;
115+ }
106116 }
107117
108118 return path ;
0 commit comments