Skip to content

Commit 56c8a9c

Browse files
[release/6.0] [tvOS] Be less eager in creating the non-existent special folders (#59024)
Co-authored-by: Filip Navara <navara@emclient.com>
1 parent f860bce commit 56c8a9c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/mono/System.Private.CoreLib/src/System/Environment.iOS.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,15 @@ static string CombineSearchPath(NSSearchPathDirectory searchPath, string subdire
100100
static string CombineDocumentDirectory(string subdirectory)
101101
{
102102
#if TARGET_TVOS
103-
string? path = CombineSearchPath(NSSearchPathDirectory.NSLibraryDirectory, Path.Combine("Caches", "Documents", subdirectory));
103+
string? path = CombineSearchPath(NSSearchPathDirectory.NSLibraryDirectory, Path.Combine("Caches", "Documents"));
104104
// Special version of CombineSearchPath which creates the path if needed.
105105
// This isn't needed for "real" search paths which always exist, but on tvOS
106106
// the base path is really a subdirectory we define rather than an OS directory.
107107
// In order to not treat Directory.Exists(SpecialFolder.ApplicationData) differently
108108
// on tvOS, guarantee that it exists by creating it here
109-
if (!Directory.Exists (path))
110-
Directory.CreateDirectory (path);
109+
if (!Directory.Exists(path))
110+
Directory.CreateDirectory(path);
111+
path = Path.Combine(path, subdirectory);
111112
#else
112113
string? path = CombineSearchPath(NSSearchPathDirectory.NSDocumentDirectory, subdirectory);
113114
#endif

0 commit comments

Comments
 (0)