Format CorePsPlatform
This commit is contained in:
parent
77a9b4b5d2
commit
551e2e6fc4
|
@ -143,12 +143,12 @@ namespace System.Management.Automation
|
||||||
//the user has set XDG_DATA_HOME corresponding to module path
|
//the user has set XDG_DATA_HOME corresponding to module path
|
||||||
if (String.IsNullOrEmpty(xdgdatahome)){
|
if (String.IsNullOrEmpty(xdgdatahome)){
|
||||||
|
|
||||||
// create the xdg folder if needed
|
// create the xdg folder if needed
|
||||||
if (!Directory.Exists(xdgDataHomeDefault))
|
if (!Directory.Exists(xdgDataHomeDefault))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(xdgDataHomeDefault);
|
Directory.CreateDirectory(xdgDataHomeDefault);
|
||||||
}
|
}
|
||||||
return xdgDataHomeDefault;
|
return xdgDataHomeDefault;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -159,12 +159,12 @@ namespace System.Management.Automation
|
||||||
//the user has set XDG_DATA_HOME corresponding to module path
|
//the user has set XDG_DATA_HOME corresponding to module path
|
||||||
if (String.IsNullOrEmpty(xdgdatahome)){
|
if (String.IsNullOrEmpty(xdgdatahome)){
|
||||||
|
|
||||||
//xdg values have not been set
|
//xdg values have not been set
|
||||||
if (!Directory.Exists(xdgModuleDefault)) //module folder not always guaranteed to exist
|
if (!Directory.Exists(xdgModuleDefault)) //module folder not always guaranteed to exist
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(xdgModuleDefault);
|
Directory.CreateDirectory(xdgModuleDefault);
|
||||||
}
|
}
|
||||||
return xdgModuleDefault;
|
return xdgModuleDefault;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -175,7 +175,7 @@ namespace System.Management.Automation
|
||||||
//the user has set XDG_CACHE_HOME
|
//the user has set XDG_CACHE_HOME
|
||||||
if (String.IsNullOrEmpty(xdgcachehome))
|
if (String.IsNullOrEmpty(xdgcachehome))
|
||||||
{
|
{
|
||||||
//xdg values have not been set
|
//xdg values have not been set
|
||||||
if (!Directory.Exists(xdgCacheDefault)) //module folder not always guaranteed to exist
|
if (!Directory.Exists(xdgCacheDefault)) //module folder not always guaranteed to exist
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(xdgCacheDefault);
|
Directory.CreateDirectory(xdgCacheDefault);
|
||||||
|
@ -342,12 +342,12 @@ namespace System.Management.Automation
|
||||||
return LinuxPlatform.GetUserFromPid(path);
|
return LinuxPlatform.GetUserFromPid(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CORECLR
|
#if CORECLR
|
||||||
internal static string NonWindowsGetFolderPath(SpecialFolder folder)
|
internal static string NonWindowsGetFolderPath(SpecialFolder folder)
|
||||||
{
|
{
|
||||||
return LinuxPlatform.GetFolderPath(folder);
|
return LinuxPlatform.GetFolderPath(folder);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
internal static string NonWindowsInternalGetLinkType(FileSystemInfo fileInfo)
|
internal static string NonWindowsInternalGetLinkType(FileSystemInfo fileInfo)
|
||||||
{
|
{
|
||||||
|
@ -526,40 +526,40 @@ namespace System.Management.Automation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CORECLR
|
#if CORECLR
|
||||||
public static string GetFolderPath(SpecialFolder folder)
|
public static string GetFolderPath(SpecialFolder folder)
|
||||||
{
|
{
|
||||||
string s = null;
|
string s = null;
|
||||||
switch (folder)
|
switch (folder)
|
||||||
{
|
{
|
||||||
case SpecialFolder.ProgramFiles:
|
case SpecialFolder.ProgramFiles:
|
||||||
s = "/bin";
|
s = "/bin";
|
||||||
break;
|
break;
|
||||||
case SpecialFolder.ProgramFilesX86:
|
case SpecialFolder.ProgramFilesX86:
|
||||||
s = "/usr/bin";
|
s = "/usr/bin";
|
||||||
break;
|
break;
|
||||||
case SpecialFolder.System:
|
case SpecialFolder.System:
|
||||||
s = "/sbin";
|
s = "/sbin";
|
||||||
break;
|
break;
|
||||||
case SpecialFolder.SystemX86:
|
case SpecialFolder.SystemX86:
|
||||||
s = "/sbin";
|
s = "/sbin";
|
||||||
break;
|
break;
|
||||||
case SpecialFolder.Personal:
|
case SpecialFolder.Personal:
|
||||||
s = System.Environment.GetEnvironmentVariable("HOME");
|
s = System.Environment.GetEnvironmentVariable("HOME");
|
||||||
break;
|
break;
|
||||||
case SpecialFolder.LocalApplicationData:
|
case SpecialFolder.LocalApplicationData:
|
||||||
s = System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("HOME"), ".config");
|
s = System.IO.Path.Combine(System.Environment.GetEnvironmentVariable("HOME"), ".config");
|
||||||
if (!System.IO.Directory.Exists(s))
|
if (!System.IO.Directory.Exists(s))
|
||||||
{
|
{
|
||||||
System.IO.Directory.CreateDirectory(s);
|
System.IO.Directory.CreateDirectory(s);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public static bool IsHardLink(ref IntPtr handle)
|
public static bool IsHardLink(ref IntPtr handle)
|
||||||
{
|
{
|
||||||
|
@ -602,12 +602,12 @@ namespace System.Management.Automation
|
||||||
switch(ret)
|
switch(ret)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
return true;
|
return true;
|
||||||
case 0:
|
case 0:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
int lastError = Marshal.GetLastWin32Error();
|
int lastError = Marshal.GetLastWin32Error();
|
||||||
throw new InvalidOperationException("LinuxPlatform.IsSymLink error: " + lastError);
|
throw new InvalidOperationException("LinuxPlatform.IsSymLink error: " + lastError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,12 +622,12 @@ namespace System.Management.Automation
|
||||||
switch(ret)
|
switch(ret)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
return true;
|
return true;
|
||||||
case 0:
|
case 0:
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
int lastError = Marshal.GetLastWin32Error();
|
int lastError = Marshal.GetLastWin32Error();
|
||||||
throw new InvalidOperationException("LinuxPlatform.IsExecutable error: " + lastError);
|
throw new InvalidOperationException("LinuxPlatform.IsExecutable error: " + lastError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue