From 56c8a9cd1c4004bc0fc40f214ef1c7744a09727c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 14 Sep 2021 09:48:00 +0200 Subject: [PATCH] [release/6.0] [tvOS] Be less eager in creating the non-existent special folders (#59024) Co-authored-by: Filip Navara --- src/mono/System.Private.CoreLib/src/System/Environment.iOS.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mono/System.Private.CoreLib/src/System/Environment.iOS.cs b/src/mono/System.Private.CoreLib/src/System/Environment.iOS.cs index affed35..99d5b33 100644 --- a/src/mono/System.Private.CoreLib/src/System/Environment.iOS.cs +++ b/src/mono/System.Private.CoreLib/src/System/Environment.iOS.cs @@ -100,14 +100,15 @@ namespace System 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 -- 2.7.4