Imported Upstream version 4.8.0.309

Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-11-10 13:04:39 +00:00
parent ee1447783b
commit 94b2861243
4912 changed files with 390737 additions and 49310 deletions

View File

@@ -36,6 +36,7 @@ using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Hosting;
@@ -47,7 +48,7 @@ namespace System
[ClassInterface (ClassInterfaceType.None)]
[ComVisible (true)]
[StructLayout (LayoutKind.Sequential)]
#if NET_2_1
#if MOBILE
public sealed class AppDomainSetup
#else
public sealed class AppDomainSetup : IAppDomainSetup
@@ -139,12 +140,27 @@ namespace System
appBase = appBase.Substring (7);
if (Path.DirectorySeparatorChar != '/')
appBase = appBase.Replace ('/', Path.DirectorySeparatorChar);
if (Environment.IsRunningOnWindows) {
// Under Windows prepend "//" to indicate it's a local file
appBase = "//" + appBase;
}
appBase = Path.GetFullPath (appBase);
if (Path.DirectorySeparatorChar != '/') {
bool isExtendedPath = appBase.StartsWith (@"\\?\", StringComparison.Ordinal);
if (appBase.IndexOf (':', isExtendedPath ? 6 : 2) != -1) {
throw new NotSupportedException ("The given path's format is not supported.");
}
} else {
appBase = Path.GetFullPath (appBase);
}
// validate the path
string dir = Path.GetDirectoryName (appBase);
if ((dir != null) && (dir.LastIndexOfAny (Path.GetInvalidPathChars ()) >= 0)) {
string msg = String.Format (Locale.GetText ("Invalid path characters in path: '{0}'"), appBase);
throw new ArgumentException (msg, "appBase");
}
string fname = Path.GetFileName (appBase);
if ((fname != null) && (fname.LastIndexOfAny (Path.GetInvalidFileNameChars ()) >= 0)) {
string msg = String.Format (Locale.GetText ("Invalid filename characters in path: '{0}'"), appBase);
throw new ArgumentException (msg, "appBase");
}
return appBase;