namespace BomLocalService.Utilities;
public static class FilePathHelper
{
///
/// Gets the cache directory path from configuration or returns default
///
public static string GetCacheDirectory(IConfiguration configuration)
{
return configuration.GetValue("CacheDirectory")
?? Path.Combine(AppContext.BaseDirectory, "cache");
}
///
/// Gets the metadata file path for a given screenshot path
///
public static string GetMetadataFilePath(string screenshotPath)
{
return Path.ChangeExtension(screenshotPath, ".json");
}
///
/// Gets the cache file pattern for a location key (e.g., "Pomona_QLD_*.png")
///
public static string GetCacheFilePattern(string locationKey)
{
var safeLocationKey = LocationHelper.SanitizeFileName(locationKey);
return $"{safeLocationKey}_*.png";
}
///
/// Gets the cache file pattern for suburb and state
///
public static string GetCacheFilePattern(string suburb, string state)
{
var locationKey = LocationHelper.GetLocationKey(suburb, state);
return GetCacheFilePattern(locationKey);
}
}