R: rename EnsureDirectory to EnsureDirectoryExists and similar
This commit is contained in:
parent
35e3625d4b
commit
9b28fbecd6
6 changed files with 15 additions and 15 deletions
|
@ -73,14 +73,14 @@ namespace Microsoft.DotNet.Tools.Common
|
|||
return path;
|
||||
}
|
||||
|
||||
public static void EnsureParentDirectory(string filePath)
|
||||
public static void EnsureParentDirectoryExists(string filePath)
|
||||
{
|
||||
string directory = Path.GetDirectoryName(filePath);
|
||||
|
||||
EnsureDirectory(directory);
|
||||
EnsureDirectoryExists(directory);
|
||||
}
|
||||
|
||||
public static void EnsureDirectory(string directoryPath)
|
||||
public static void EnsureDirectoryExists(string directoryPath)
|
||||
{
|
||||
if (!Directory.Exists(directoryPath))
|
||||
{
|
||||
|
|
|
@ -51,14 +51,14 @@ namespace Microsoft.DotNet.Internal.ProjectModel.Utilities
|
|||
return path + trailingCharacter;
|
||||
}
|
||||
|
||||
public static void EnsureParentDirectory(string filePath)
|
||||
public static void EnsureParentDirectoryExists(string filePath)
|
||||
{
|
||||
string directory = Path.GetDirectoryName(filePath);
|
||||
|
||||
EnsureDirectory(directory);
|
||||
EnsureDirectoryExists(directory);
|
||||
}
|
||||
|
||||
public static void EnsureDirectory(string directoryPath)
|
||||
public static void EnsureDirectoryExists(string directoryPath)
|
||||
{
|
||||
if (!Directory.Exists(directoryPath))
|
||||
{
|
||||
|
|
|
@ -70,14 +70,14 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
{
|
||||
if (globalJson.Exists)
|
||||
{
|
||||
PathUtility.EnsureDirectory(RootBackupDirectory.FullName);
|
||||
PathUtility.EnsureDirectoryExists(RootBackupDirectory.FullName);
|
||||
|
||||
globalJson.MoveTo(Path.Combine(
|
||||
ProjectBackupDirectory.Parent.FullName,
|
||||
globalJson.Name));
|
||||
}
|
||||
|
||||
PathUtility.EnsureDirectory(ProjectBackupDirectory.FullName);
|
||||
PathUtility.EnsureDirectoryExists(ProjectBackupDirectory.FullName);
|
||||
|
||||
foreach (var file in FilesToMove)
|
||||
{
|
||||
|
@ -87,4 +87,4 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace Microsoft.DotNet.TestFramework
|
|||
|
||||
var newFile = new FileInfo(newPath);
|
||||
|
||||
PathUtility.EnsureDirectory(newFile.Directory.FullName);
|
||||
PathUtility.EnsureDirectoryExists(newFile.Directory.FullName);
|
||||
|
||||
file.CopyTo(newPath);
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@ namespace Microsoft.DotNet.TestFramework
|
|||
|
||||
Path = path;
|
||||
|
||||
EnsureExistsAndEmpty(Path);
|
||||
EnsureDirectoryAndBackupDirectoryExistAndAreEmpty(Path);
|
||||
}
|
||||
|
||||
public string Path { get; private set; }
|
||||
|
||||
private static void EnsureExistsAndEmpty(string path)
|
||||
private static void EnsureDirectoryAndBackupDirectoryExistAndAreEmpty(string path)
|
||||
{
|
||||
var testDirectory = new DirectoryInfo(path);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Microsoft.DotNet.Cli
|
|||
{
|
||||
var profileOptimizationRootPath = new MulticoreJitProfilePathCalculator().MulticoreJitProfilePath;
|
||||
|
||||
if (!TryEnsureDirectory(profileOptimizationRootPath))
|
||||
if (!TryEnsureDirectoryExists(profileOptimizationRootPath))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -43,11 +43,11 @@ namespace Microsoft.DotNet.Cli
|
|||
AssemblyLoadContext.Default.StartProfileOptimization("dotnet");
|
||||
}
|
||||
|
||||
private bool TryEnsureDirectory(string directoryPath)
|
||||
private bool TryEnsureDirectoryExists(string directoryPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
PathUtility.EnsureDirectory(directoryPath);
|
||||
PathUtility.EnsureDirectoryExists(directoryPath);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue