29 lines
762 B
C#
29 lines
762 B
C#
namespace Argus.Infrastructure;
|
|
|
|
public sealed class PackageStorageService(StoragePaths storagePaths)
|
|
{
|
|
public string ResolvePhysicalPath(string storedRelativePath)
|
|
{
|
|
var normalizedRelativePath = storedRelativePath.Replace('/', Path.DirectorySeparatorChar);
|
|
return Path.Combine(storagePaths.PackagesRootPath, normalizedRelativePath);
|
|
}
|
|
|
|
public void TryDelete(string storedRelativePath)
|
|
{
|
|
try
|
|
{
|
|
var physicalPath = ResolvePhysicalPath(storedRelativePath);
|
|
if (File.Exists(physicalPath))
|
|
{
|
|
File.Delete(physicalPath);
|
|
}
|
|
}
|
|
catch (IOException)
|
|
{
|
|
}
|
|
catch (UnauthorizedAccessException)
|
|
{
|
|
}
|
|
}
|
|
}
|