-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/FilterEscape' into FilterEscape
- Loading branch information
Showing
32 changed files
with
448 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace Microsoft.VisualStudio.TestPlatform.SettingsMigrator | ||
{ | ||
using System; | ||
using System.Globalization; | ||
using System.IO; | ||
|
||
/// <summary> | ||
/// Used to resolve the inputs provided by the user to paths needed by migrator. | ||
/// </summary> | ||
public class PathResolver | ||
{ | ||
private const string RunSettingsExtension = ".runsettings"; | ||
|
||
/// <summary> | ||
/// Gets the target path based on user inputs. | ||
/// </summary> | ||
/// <param name="args">User inputs</param> | ||
/// <returns>New file path to create</returns> | ||
public string GetTargetPath(string[] args) | ||
{ | ||
string newFilePath = null; | ||
if (args.Length < 1 || !Path.IsPathRooted(args[0])) | ||
{ | ||
return newFilePath; | ||
} | ||
|
||
if (args.Length == 1) | ||
{ | ||
var oldFilePath = args[0]; | ||
var newFileName = string.Concat(Path.GetFileNameWithoutExtension(oldFilePath), "_", DateTime.Now.ToString("MM-dd-yyyy_hh-mm-ss"), RunSettingsExtension); | ||
newFilePath = Path.Combine(Path.GetDirectoryName(oldFilePath), newFileName); | ||
} | ||
else if (args.Length == 2) | ||
{ | ||
newFilePath = args[1]; | ||
if (!Path.IsPathRooted(newFilePath) || !string.Equals(Path.GetExtension(newFilePath), RunSettingsExtension, StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
newFilePath = null; | ||
} | ||
} | ||
|
||
return newFilePath; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.