Skip to content
Merged
Changes from all commits
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
[tvOS] Be less eager in creating the non-existent special folders
Fixes #58787
  • Loading branch information
filipnavara authored and github-actions committed Sep 13, 2021
commit 6cfc0493c1e4fa07e5fb975cc3cf3ad7f54f5f2f
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,15 @@ static string CombineSearchPath(NSSearchPathDirectory searchPath, string subdire
static string CombineDocumentDirectory(string subdirectory)
{
#if TARGET_TVOS
string? path = CombineSearchPath(NSSearchPathDirectory.NSLibraryDirectory, Path.Combine("Caches", "Documents", subdirectory));
string? path = CombineSearchPath(NSSearchPathDirectory.NSLibraryDirectory, Path.Combine("Caches", "Documents"));
// Special version of CombineSearchPath which creates the path if needed.
// This isn't needed for "real" search paths which always exist, but on tvOS
// the base path is really a subdirectory we define rather than an OS directory.
// In order to not treat Directory.Exists(SpecialFolder.ApplicationData) differently
// on tvOS, guarantee that it exists by creating it here
if (!Directory.Exists (path))
Directory.CreateDirectory (path);
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
path = Path.Combine(path, subdirectory);
#else
string? path = CombineSearchPath(NSSearchPathDirectory.NSDocumentDirectory, subdirectory);
#endif
Expand Down