fix: Cleans up archiving and fixes wrong relative path used (#825)
This commit is contained in:
parent
507eba34a8
commit
fe0abc4a8f
2 changed files with 10 additions and 7 deletions
|
|
@ -14,7 +14,8 @@ namespace Server.Compression
|
|||
// bsdtar has a bug and hangs, so we are doing it in two steps.
|
||||
if (Core.IsWindows)
|
||||
{
|
||||
var tempTarArchive = Path.Combine(Core.BaseDirectory, "temp/temp-file.tar");
|
||||
var tempDir = PathUtility.EnsureRandomPath(Path.GetTempPath());
|
||||
var tempTarArchive = Path.Combine(tempDir, "temp-file.tar");
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -54,11 +55,12 @@ namespace Server.Compression
|
|||
// bsdtar has a bug and hangs, so we are doing it in two steps.
|
||||
if (Core.IsWindows)
|
||||
{
|
||||
var tempTarArchive = Path.Combine(Core.BaseDirectory, "temp/temp-file.tar");
|
||||
var tempDir = PathUtility.EnsureRandomPath(Path.GetTempPath());
|
||||
var tempTarArchive = Path.Combine(tempDir, "temp-file.tar");
|
||||
|
||||
try
|
||||
{
|
||||
if (!TarArchive.CreateFromPaths(paths, relativeTo, tempTarArchive))
|
||||
if (!TarArchive.CreateFromPaths(paths, tempTarArchive, relativeTo))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -83,7 +85,7 @@ namespace Server.Compression
|
|||
}
|
||||
finally
|
||||
{
|
||||
File.Delete(tempTarArchive);
|
||||
Directory.Delete(tempDir, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue