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;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void EnsureParentDirectory(string filePath)
|
public static void EnsureParentDirectoryExists(string filePath)
|
||||||
{
|
{
|
||||||
string directory = Path.GetDirectoryName(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))
|
if (!Directory.Exists(directoryPath))
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,14 +51,14 @@ namespace Microsoft.DotNet.Internal.ProjectModel.Utilities
|
||||||
return path + trailingCharacter;
|
return path + trailingCharacter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void EnsureParentDirectory(string filePath)
|
public static void EnsureParentDirectoryExists(string filePath)
|
||||||
{
|
{
|
||||||
string directory = Path.GetDirectoryName(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))
|
if (!Directory.Exists(directoryPath))
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,14 +70,14 @@ namespace Microsoft.DotNet.ProjectJsonMigration
|
||||||
{
|
{
|
||||||
if (globalJson.Exists)
|
if (globalJson.Exists)
|
||||||
{
|
{
|
||||||
PathUtility.EnsureDirectory(RootBackupDirectory.FullName);
|
PathUtility.EnsureDirectoryExists(RootBackupDirectory.FullName);
|
||||||
|
|
||||||
globalJson.MoveTo(Path.Combine(
|
globalJson.MoveTo(Path.Combine(
|
||||||
ProjectBackupDirectory.Parent.FullName,
|
ProjectBackupDirectory.Parent.FullName,
|
||||||
globalJson.Name));
|
globalJson.Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
PathUtility.EnsureDirectory(ProjectBackupDirectory.FullName);
|
PathUtility.EnsureDirectoryExists(ProjectBackupDirectory.FullName);
|
||||||
|
|
||||||
foreach (var file in FilesToMove)
|
foreach (var file in FilesToMove)
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,7 +102,7 @@ namespace Microsoft.DotNet.TestFramework
|
||||||
|
|
||||||
var newFile = new FileInfo(newPath);
|
var newFile = new FileInfo(newPath);
|
||||||
|
|
||||||
PathUtility.EnsureDirectory(newFile.Directory.FullName);
|
PathUtility.EnsureDirectoryExists(newFile.Directory.FullName);
|
||||||
|
|
||||||
file.CopyTo(newPath);
|
file.CopyTo(newPath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,12 @@ namespace Microsoft.DotNet.TestFramework
|
||||||
|
|
||||||
Path = path;
|
Path = path;
|
||||||
|
|
||||||
EnsureExistsAndEmpty(Path);
|
EnsureDirectoryAndBackupDirectoryExistAndAreEmpty(Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Path { get; private set; }
|
public string Path { get; private set; }
|
||||||
|
|
||||||
private static void EnsureExistsAndEmpty(string path)
|
private static void EnsureDirectoryAndBackupDirectoryExistAndAreEmpty(string path)
|
||||||
{
|
{
|
||||||
var testDirectory = new DirectoryInfo(path);
|
var testDirectory = new DirectoryInfo(path);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Microsoft.DotNet.Cli
|
||||||
{
|
{
|
||||||
var profileOptimizationRootPath = new MulticoreJitProfilePathCalculator().MulticoreJitProfilePath;
|
var profileOptimizationRootPath = new MulticoreJitProfilePathCalculator().MulticoreJitProfilePath;
|
||||||
|
|
||||||
if (!TryEnsureDirectory(profileOptimizationRootPath))
|
if (!TryEnsureDirectoryExists(profileOptimizationRootPath))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -43,11 +43,11 @@ namespace Microsoft.DotNet.Cli
|
||||||
AssemblyLoadContext.Default.StartProfileOptimization("dotnet");
|
AssemblyLoadContext.Default.StartProfileOptimization("dotnet");
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TryEnsureDirectory(string directoryPath)
|
private bool TryEnsureDirectoryExists(string directoryPath)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PathUtility.EnsureDirectory(directoryPath);
|
PathUtility.EnsureDirectoryExists(directoryPath);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue