mirror of
https://github.com/Ellpeck/GameBundle.git
synced 2024-11-22 16:48:34 +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,6 +101,7 @@ 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");
|
||||||
|
if (File.Exists(zipLocation))
|
||||||
File.Delete(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);
|
||||||
|
|
Loading…
Reference in a new issue