Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6354dd0
Use a different Personal folder on tvOS, and a test that it works
Aug 16, 2021
0ee7a71
Run this PR on device, the error does not happen on sim
Aug 16, 2021
5854dfc
CI fixes
Aug 16, 2021
7473c19
Nullable
Aug 16, 2021
877258f
Test on devices
Aug 16, 2021
b032fc0
Just run one test to save disk space
Aug 16, 2021
43573f7
Tweak to run only 1 test and make sure DevTeamProvisioning is right
Aug 17, 2021
a39e472
Horrible hack to check something in CI
Aug 17, 2021
392a09b
Merge branch 'tvos-specialdirectories' of github.com:directhex/runtim…
Aug 17, 2021
cfcb6dc
Revert all changes. Run as-is in CI to see if it's my changes to blame
Aug 17, 2021
c50a1af
nonsense
Aug 17, 2021
7e7d49b
Set temp path to a valid location
Aug 18, 2021
064670d
Fix AppDomainTests.ExecuteAssembly to copy files to a valid place
Aug 18, 2021
a48cfe7
Don't expect HOME to work on tvOS
Aug 18, 2021
26354d7
We cannot get exit code from tvOS device, so runonly tests don't work
Aug 18, 2021
4ee0555
Revert infra changes made to enable CI of this PR, which passes now o…
Aug 18, 2021
75bf9e2
Merge remote-tracking branch 'origin/main' into tvos-specialdirectories
Aug 18, 2021
07660e2
Add NSTemporaryDirectory interop function and supporting cast
Aug 18, 2021
e57d693
Merge remote-tracking branch 'origin/tvos-specialdirectories' into tv…
Aug 18, 2021
4b49b07
forgot a void
Aug 19, 2021
84609fc
Requested changes from Alex
Aug 19, 2021
b936dc1
Merge remote-tracking branch 'origin/main' into tvos-specialdirectories
Aug 20, 2021
5ad98b9
Merge remote-tracking branch 'origin/main' into tvos-specialdirectories
Aug 23, 2021
9ebb6b0
Don't use nullable
Aug 23, 2021
fc2cf38
Revert AppDominTests changes, not clear they're needed
Aug 23, 2021
74ddcff
namespace
Aug 23, 2021
a619fa7
Update src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.i…
directhex Aug 23, 2021
33788e1
Revert unused props
Aug 23, 2021
a3d96ed
Update src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.i…
directhex Aug 23, 2021
0baf69f
Update src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.i…
directhex Aug 23, 2021
e85a9e4
Update src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.i…
directhex Aug 23, 2021
6f338fa
Update src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.N…
directhex Aug 23, 2021
eb5706a
Changes squashing other changes, bleh
Aug 23, 2021
67a6c1d
Update src/libraries/System.Private.CoreLib/src/System/IO/Path.Unix.i…
directhex Aug 23, 2021
e3cbd8c
error CA1805: Member 's_defaultTempPath' is explicitly initialized to…
Aug 23, 2021
538b631
Merge remote-tracking branch 'origin/main' into tvos-specialdirectories
Aug 23, 2021
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
Requested changes from Alex
  • Loading branch information
Jo Shields committed Aug 19, 2021
commit 84609fcace543b319f44443a1f7facca981ba868
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Xunit;
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading;
Expand All @@ -21,7 +20,6 @@ public abstract class FileCleanupTestBase : IDisposable
/// <summary>Initialize the test class base. This creates the associated test directory.</summary>
protected FileCleanupTestBase(string tempDirectory = null)
{
//tempDirectory ??= PlatformDetection.IsNotAppleMobile ? Path.GetTempPath() : Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
tempDirectory ??= Path.GetTempPath();

// Use a unique test directory per test class. The test directory lives in the user's temp directory,
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/Native/Unix/System.Native/pal_searchpath.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

const char* SystemNative_SearchPath_TempDirectory()
{
NSString* iosPath = NSTemporaryDirectory();
const char *path = [iosPath UTF8String];
NSString* tempPath = NSTemporaryDirectory();
const char *path = [tempPath UTF8String];
return path == NULL ? NULL : strdup (path);
}
34 changes: 15 additions & 19 deletions src/mono/System.Private.CoreLib/src/System/Environment.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,16 @@ private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOptio

private static string? GetSpecialFolder(SpecialFolder folder)
{
#if TARGET_TVOS
string? DocumentsSearchPath = CombineAndCreateSearchPath(NSSearchPathDirectory.NSLibraryDirectory, Path.Combine("Caches", "Documents"));
#else
string? DocumentsSearchPath = Interop.Sys.SearchPath(NSSearchPathDirectory.NSDocumentDirectory);
#endif

switch (folder)
{
case SpecialFolder.Personal:
case SpecialFolder.LocalApplicationData:
return DocumentsSearchPath;
return CombineDocumentDirectory(string.Empty);

case SpecialFolder.ApplicationData:
// note: at first glance that looked like a good place to return NSLibraryDirectory
// but it would break isolated storage for existing applications
return DocumentsSearchPath != null ? Path.Combine(DocumentsSearchPath, ".config") : string.Empty;
return CombineDocumentDirectory(".config");

case SpecialFolder.Resources:
return Interop.Sys.SearchPath(NSSearchPathDirectory.NSLibraryDirectory); // older (8.2 and previous) would return String.Empty
Expand All @@ -65,7 +59,7 @@ private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOptio
return Path.Combine(GetFolderPathCore(SpecialFolder.Personal, SpecialFolderOption.None), "Pictures");

case SpecialFolder.Templates:
return DocumentsSearchPath != null ? Path.Combine(DocumentsSearchPath, "Templates") : string.Empty;
return CombineDocumentDirectory("Templates");

case SpecialFolder.MyVideos:
return Path.Combine(GetFolderPathCore(SpecialFolder.Personal, SpecialFolderOption.None), "Videos");
Expand All @@ -74,7 +68,7 @@ private static string GetFolderPathCore(SpecialFolder folder, SpecialFolderOptio
return "/usr/share/templates";

case SpecialFolder.Fonts:
return DocumentsSearchPath != null ? Path.Combine(DocumentsSearchPath, ".fonts") : string.Empty;
return CombineDocumentDirectory(".fonts");

case SpecialFolder.Favorites:
return CombineSearchPath(NSSearchPathDirectory.NSLibraryDirectory, "Favorites");
Expand Down Expand Up @@ -103,20 +97,22 @@ static string CombineSearchPath(NSSearchPathDirectory searchPath, string subdire
string.Empty;
}

#if TARGET_TVOS
// 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
static string CombineAndCreateSearchPath(NSSearchPathDirectory searchPath, string subdirectory)
static string CombineDocumentDirectory(string subdirectory)
{
string path = CombineSearchPath(searchPath, subdirectory);
#if TARGET_TVOS
string? path = CombineSearchPath(NSSearchPathDirectory.NSLibraryDirectory, Path.Combine("Caches", "Documents", subdirectory));
// 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);
#else
string? path = CombineSearchPath(NSSearchPathDirectory.NSDocumentDirectory, subdirectory);
#endif
return path;
}
#endif
}
}
}