mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
XDG cache directory now guaranteed to exist
This commit is contained in:
1 parent
d5f6295042
commit
539f8696e5
1 file changed
+10
-14
@@ -185,21 +185,17 @@ namespace Microsoft.PowerShell
|
||||
{
|
||||
profileDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) +
|
||||
@"\Microsoft\Windows\PowerShell";
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
if (!Directory.Exists(profileDir))
|
||||
{
|
||||
//check if the user has set an XDG path in their environment variables
|
||||
profileDir = Platform.SelectProductNameForDirectory(Platform.XDG_Type.CACHE);
|
||||
|
||||
if (!Directory.Exists(profileDir)) //xdg value may have been set but not a valid directory
|
||||
{
|
||||
Console.Error.WriteLine("The selected directory (" + profileDir +") for the profile does not exist. Using the default path.");
|
||||
profileDir = Platform.SelectProductNameForDirectory(Platform.XDG_Type.DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Directory.CreateDirectory(profileDir);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
profileDir = Platform.SelectProductNameForDirectory(Platform.XDG_Type.CACHE);
|
||||
}
|
||||
|
||||
ClrFacade.SetProfileOptimizationRoot(profileDir);
|
||||
}
|
||||
catch
|
||||
|
||||
Reference in new issue
Block a user