Skip to content

Commit

Permalink
chore: update FileSystemTasks usages
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch committed Jun 12, 2024
1 parent 540c5aa commit 86fc7ca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
11 changes: 4 additions & 7 deletions build/Build.GlobalSolution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using Nuke.Common.Utilities;
using Nuke.Utilities.Text.Yaml;
using static Nuke.Common.ControlFlow;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.ProjectModel.SolutionModelTasks;
using static Nuke.Common.Tools.Git.GitTasks;

Expand Down Expand Up @@ -67,18 +66,16 @@ IEnumerable<GitRepository> ExternalRepositories
if ((RootDirectory / $"{Solution.FileName}.DotSettings").FileExists())
{
CopyFile(
source: RootDirectory / $"{Solution.FileName}.DotSettings",
(RootDirectory / $"{Solution.FileName}.DotSettings").Copy(
target: RootDirectory / $"{global.FileName}.DotSettings",
FileExistsPolicy.Overwrite);
policy: ExistsPolicy.FileOverwrite);
}
if ((RootDirectory / $"{Solution.FileName}.DotSettings.user").FileExists())
{
CopyFile(
source: RootDirectory / $"{Solution.FileName}.DotSettings.user",
(RootDirectory / $"{Solution.FileName}.DotSettings.user").Copy(
target: RootDirectory / $"{global.FileName}.DotSettings.user",
FileExistsPolicy.Overwrite);
policy: ExistsPolicy.FileOverwrite);
}
});
}
8 changes: 3 additions & 5 deletions source/Nuke.Common/Tools/ReSharper/ReSharperTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ private static void PreProcess<T>(ref T toolSettings) where T : ReSharperSetting
var wave = GetWave(toolSettings).NotNull("wave != null");
var shadowDirectory = GetShadowDirectory(toolSettings, wave);

FileSystemTasks.CopyDirectoryRecursively(
Path.GetDirectoryName(toolSettings.ProcessToolPath).NotNull(),
shadowDirectory,
DirectoryExistsPolicy.Merge,
FileExistsPolicy.OverwriteIfNewer);
((AbsolutePath)toolSettings.ProcessToolPath.NotNull()).Copy(
target: shadowDirectory,
policy: ExistsPolicy.MergeAndOverwriteIfNewer);

toolSettings.Plugins
.Select(x => (Plugin: x.Key, Version: x.Value == ReSharperPluginLatest ? null : x.Value))
Expand Down
10 changes: 2 additions & 8 deletions source/Nuke.Common/Utilities/TemplateUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,14 @@ private static void FillTemplateDirectoryRecursivelyInternal(
FillTemplateFile(file, tokens);

if (ShouldMove(file))
FileSystemTasks.RenameFile(file, file.Name.Replace(tokens), FileExistsPolicy.OverwriteIfNewer);
file.Rename(file.Name.Replace(tokens), ExistsPolicy.FileOverwriteIfNewer);
}

directory.GetDirectories()
.ForEach(x => FillTemplateDirectoryRecursivelyInternal(x, tokens, excludeDirectory, excludeFile));

if (ShouldMove(directory))
{
FileSystemTasks.RenameDirectory(
directory,
directory.Name.Replace(tokens),
DirectoryExistsPolicy.Merge,
FileExistsPolicy.OverwriteIfNewer);
}
directory.Rename(directory.Name.Replace(tokens), ExistsPolicy.MergeAndOverwriteIfNewer);
}

public static void FillTemplateFile(
Expand Down

0 comments on commit 86fc7ca

Please sign in to comment.