Create DB work in-progress (#350)

* Stage changes to other machine

* Stage changes

* Update SMO to fix SMO missing Login bug on macOS
This commit is contained in:
Karl Burtram
2017-05-15 18:48:04 -07:00
committed by GitHub
parent b26b7674b3
commit dc3cd9ea59
12 changed files with 109 additions and 61 deletions

View File

@@ -11,6 +11,7 @@ using System.Text.RegularExpressions;
using System.Linq;
using Microsoft.SqlTools.Utility;
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
using System.Runtime.InteropServices;
namespace Microsoft.SqlTools.ServiceLayer.Workspace
{
@@ -114,7 +115,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Workspace
// Client sent the path in URI format, extract the local path and trim
// any extraneous slashes
Uri fileUri = new Uri(filePath);
filePath = fileUri.LocalPath.TrimStart('/');
filePath = fileUri.LocalPath;
if (filePath.StartsWith("//") || filePath.StartsWith("\\\\"))
{
filePath = filePath.Substring(1);
}
}
// Clients could specify paths with escaped space, [ and ] characters which .NET APIs
@@ -122,6 +127,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Workspace
// into the SqlTools engine.
filePath = UnescapePath(filePath);
// switch to unix path separators on non-Windows platforms
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
filePath = filePath.Replace('\\', '/');
}
// Get the absolute file path
filePath = Path.GetFullPath(filePath);
}