Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ Additional Features #65

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added the ability to override the download location for the Cache
  • Loading branch information
SimonDarksideJ committed Jan 6, 2024
commit 07a3657b288f599e31c0d4560ca946b3a171cbb9
28 changes: 27 additions & 1 deletion Utilities.Rest/Packages/com.utilities.rest/Runtime/Rest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,37 @@ private static IDownloadCache Cache
_ => new DiskDownloadCache()
};

private static string downloadLocation = Application.temporaryCachePath;
private static List<string> allowedDownloadLocations = new()
{
Application.temporaryCachePath,
Application.persistentDataPath,
Application.dataPath,
Application.streamingAssetsPath
};

public static string DownloadLocation
{
get => downloadLocation;

set
{
if (allowedDownloadLocations.Contains(value))
{
downloadLocation = value;
}
else
{
Debug.LogError($"Invalid Download location specified");
}
}
}

/// <summary>
/// The download cache directory.<br/>
/// </summary>
public static string DownloadCacheDirectory
=> Path.Combine(Application.temporaryCachePath, download_cache);
=> Path.Combine(DownloadLocation, download_cache);

/// <summary>
/// Creates the <see cref="DownloadCacheDirectory"/> if it doesn't exist.
Expand Down