mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
fix the file path with the wrong path separator (#545)
* fix the file path with the wrong path separator * fixed a typo
This commit is contained in:
@@ -637,7 +637,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.RestoreOperation
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(this.DataFilesFolder))
|
if (!string.IsNullOrEmpty(this.DataFilesFolder))
|
||||||
{
|
{
|
||||||
dbFile.PhysicalNameRelocate = PathWrapper.Combine(this.DataFilesFolder, fileName);
|
dbFile.PhysicalNameRelocate = CombineToServerConnectionPath(this.DataFilesFolder, fileName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -648,7 +648,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.RestoreOperation
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(this.LogFilesFolder))
|
if (!string.IsNullOrEmpty(this.LogFilesFolder))
|
||||||
{
|
{
|
||||||
dbFile.PhysicalNameRelocate = PathWrapper.Combine(this.LogFilesFolder, fileName);
|
dbFile.PhysicalNameRelocate = CombineToServerConnectionPath(this.LogFilesFolder, fileName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -663,6 +663,23 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.RestoreOperation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Combining the root and file name using the server connection file path seperator
|
||||||
|
/// </summary>
|
||||||
|
private string CombineToServerConnectionPath(string root, string filePath)
|
||||||
|
{
|
||||||
|
string pathSeparatorFromServerConnection = PathWrapper.PathSeparatorFromServerConnection(Server.ConnectionContext);
|
||||||
|
string combinedPath = PathWrapper.Combine(root, filePath);
|
||||||
|
|
||||||
|
// Make sure all path seperators are server connection separator
|
||||||
|
string result = combinedPath.Replace(Path.DirectorySeparatorChar.ToString(), pathSeparatorFromServerConnection);
|
||||||
|
|
||||||
|
// Make sure there's not any double file seperator in the path
|
||||||
|
result = result.Replace(pathSeparatorFromServerConnection + pathSeparatorFromServerConnection,
|
||||||
|
pathSeparatorFromServerConnection);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the Restore folder location of those db files whose orginal directory location
|
/// Updates the Restore folder location of those db files whose orginal directory location
|
||||||
/// is not present in the destination computer.
|
/// is not present in the destination computer.
|
||||||
|
|||||||
Reference in New Issue
Block a user