mirror of
https://github.com/Ellpeck/GameBundle.git
synced 2024-11-26 02:18:35 +01:00
delete old build directories when renaming
This commit is contained in:
parent
bab7836c05
commit
c39b5741fc
1 changed files with 6 additions and 2 deletions
|
@ -83,7 +83,10 @@ namespace GameBundle {
|
||||||
Console.WriteLine("Couldn't determine build name, aborting");
|
Console.WriteLine("Couldn't determine build name, aborting");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
buildDir.MoveTo(Path.Combine(buildDir.Parent.FullName, $"{name}-{buildDir.Name}"));
|
var dest = Path.Combine(buildDir.Parent.FullName, $"{name}-{buildDir.Name}");
|
||||||
|
if (Directory.Exists(dest))
|
||||||
|
Directory.Delete(dest, true);
|
||||||
|
buildDir.MoveTo(dest);
|
||||||
if (options.Verbose)
|
if (options.Verbose)
|
||||||
Console.WriteLine($"Moved build directory to {buildDir.FullName}");
|
Console.WriteLine($"Moved build directory to {buildDir.FullName}");
|
||||||
}
|
}
|
||||||
|
@ -98,7 +101,8 @@ namespace GameBundle {
|
||||||
// Zip the output if required
|
// Zip the output if required
|
||||||
if (options.Zip) {
|
if (options.Zip) {
|
||||||
var zipLocation = Path.Combine(buildDir.Parent.FullName, $"{buildDir.Name}.zip");
|
var zipLocation = Path.Combine(buildDir.Parent.FullName, $"{buildDir.Name}.zip");
|
||||||
File.Delete(zipLocation);
|
if (File.Exists(zipLocation))
|
||||||
|
File.Delete(zipLocation);
|
||||||
ZipFile.CreateFromDirectory(buildDir.FullName, zipLocation, CompressionLevel.Optimal, true);
|
ZipFile.CreateFromDirectory(buildDir.FullName, zipLocation, CompressionLevel.Optimal, true);
|
||||||
buildDir.Delete(true);
|
buildDir.Delete(true);
|
||||||
if (options.Verbose)
|
if (options.Verbose)
|
||||||
|
|
Loading…
Reference in a new issue