Whitespace and formatting cleanups

This commit is contained in:
Andrew Schwartzmeyer 2016-06-06 13:37:27 -07:00
parent 140d452ba2
commit 0e10a51802
5 changed files with 63 additions and 68 deletions

View file

@ -169,40 +169,39 @@ namespace Microsoft.PowerShell
WordDelimiters = DefaultWordDelimiters;
HistorySearchCaseSensitive = DefaultHistorySearchCaseSensitive;
HistorySaveStyle = DefaultHistorySaveStyle;
string historyFileName = hostName + "_history.txt";
#if CORECLR
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) // MS Windows
{
HistorySavePath = System.IO.Path.Combine(Environment.GetEnvironmentVariable("APPDATA"),
@"Microsoft\Windows\PowerShell\PSReadline\",
hostName + "_history.txt");
historyFileName);
}
else
{
//PSReadline does not have access to Utils.CorePSPlatform. Must set PSReadline path seperately
string historypath = System.Environment.GetEnvironmentVariable("XDG_DATA_HOME");
// PSReadline does not have access to Utils.CorePSPlatform. Must set PSReadline path separately
string historyPath = System.Environment.GetEnvironmentVariable("XDG_DATA_HOME");
if (!String.IsNullOrEmpty(historypath))
if (!String.IsNullOrEmpty(historyPath))
{
historypath = System.IO.Path.Combine(historypath, "powershell", "PSReadLine", hostName + "_history.txt");
HistorySavePath = historypath;
historyPath = System.IO.Path.Combine(historyPath, "powershell", "PSReadLine", historyFileName);
HistorySavePath = historyPath;
}
else
{
//While a module, history save path goes into the larger .local/share/powershell folder
HistorySavePath = System.IO.Path.Combine(
Environment.GetEnvironmentVariable("HOME"),
// History is data, so it goes into .local/share/powershell folder
HistorySavePath = System.IO.Path.Combine(Environment.GetEnvironmentVariable("HOME"),
".local",
"share",
"powershell",
"PSReadLine",
hostName + "_history.txt");
historyFileName);
}
}
#else
HistorySavePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
+ @"\Microsoft\Windows\PowerShell\PSReadline\" + hostName + "_history.txt";
HistorySavePath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
+ @"\Microsoft\Windows\PowerShell\PSReadline\" + historyFileName;
#endif
CommandValidationHandler = null;
CommandsToValidateScriptBlockArguments = new HashSet<string>(StringComparer.OrdinalIgnoreCase)

View file

@ -21,6 +21,7 @@ using SpecialFolder = System.Management.Automation.Environment.SpecialFolder;
namespace System.Management.Automation
{
/// <summary>
/// These are platform abstractions and platform specific implementations
///
@ -50,7 +51,6 @@ namespace System.Management.Automation
MODULES,
CACHE,
DEFAULT
}
public static bool IsOSX

View file

@ -604,7 +604,6 @@ namespace System.Management.Automation
psHome = psHome.ToLowerInvariant().Replace("\\syswow64\\", "\\system32\\");
}
Interlocked.CompareExchange(ref SystemWideModulePath, Path.Combine(psHome, Utils.ModuleDirectory), null);
}
return SystemWideModulePath;

View file

@ -152,7 +152,6 @@ namespace System.Management.Automation
{
continue;
}
command = new PSCommand();
command.AddCommand(profilePath, false);
commands.Add(command);
@ -187,9 +186,7 @@ namespace System.Management.Automation
{
basePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
basePath = IO.Path.Combine(basePath, Utils.ProductNameForDirectory);
}
else
{
basePath = GetAllUsersFolderPath(shellId);