Skip to content

Commit

Permalink
dotnet#74642 removed redundunt code
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhamoyan committed Sep 16, 2022
1 parent 5732db6 commit 254242f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,15 @@ namespace System.IO.IsolatedStorage
{
public static partial class TestHelper
{
static TestHelper()
private static List<string> GetRoots()
{
s_rootDirectoryProperty = typeof(IsolatedStorageFile).GetProperty("RootDirectory", BindingFlags.NonPublic | BindingFlags.Instance);

s_roots = new List<string>();

string hash;
object identity;
Helper.GetDefaultIdentityAndHash(out identity, out hash, '.');

List<string> roots = new List<string>();
string userRoot = Helper.GetDataDirectory(IsolatedStorageScope.User);
string randomUserRoot = Helper.GetRandomDirectory(userRoot, IsolatedStorageScope.User);
s_roots.Add(randomUserRoot);
roots.Add(randomUserRoot);

// Application scope doesn't go under a random dir
s_roots.Add(userRoot);

// https://github.com/dotnet/runtime/issues/2092
// https://github.com/dotnet/runtime/issues/21742
if (OperatingSystem.IsWindows()
&& !PlatformDetection.IsInAppContainer)
{
s_roots.Add(Helper.GetDataDirectory(IsolatedStorageScope.Machine));
}

// We don't expose Roaming yet
// Helper.GetDataDirectory(IsolatedStorageScope.Roaming);
roots.Add(userRoot);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,28 @@ namespace System.IO.IsolatedStorage
{
public static partial class TestHelper
{
static TestHelper()
private static List<string> GetRoots()
{
s_rootDirectoryProperty = typeof(IsolatedStorageFile).GetProperty("RootDirectory", BindingFlags.NonPublic | BindingFlags.Instance);

s_roots = new List<string>();

string hash;
object identity;
Helper.GetDefaultIdentityAndHash(out identity, out hash, '.');

List<string> roots = new List<string>();
string userRoot = Helper.GetDataDirectory(IsolatedStorageScope.User);
string randomUserRoot = Helper.GetRandomDirectory(userRoot, IsolatedStorageScope.User);
s_roots.Add(Path.Combine(randomUserRoot, hash));
s_roots.Add(randomUserRoot);


roots.Add(Path.Combine(randomUserRoot, hash));
// Application scope doesn't go under a random dir
s_roots.Add(Path.Combine(userRoot, hash));
s_roots.Add(userRoot);
roots.Add(Path.Combine(userRoot, hash));

// https://github.com/dotnet/runtime/issues/2092
// https://github.com/dotnet/runtime/issues/21742
if (OperatingSystem.IsWindows()
&& !PlatformDetection.IsInAppContainer)
{
s_roots.Add(Helper.GetDataDirectory(IsolatedStorageScope.Machine));
roots.Add(Helper.GetDataDirectory(IsolatedStorageScope.Machine));
}

// We don't expose Roaming yet
// Helper.GetDataDirectory(IsolatedStorageScope.Roaming);
return roots;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ public static partial class TestHelper
private static PropertyInfo s_rootDirectoryProperty;
private static List<string> s_roots;

static TestHelper()
{
s_rootDirectoryProperty = typeof(IsolatedStorageFile).GetProperty("RootDirectory", BindingFlags.NonPublic | BindingFlags.Instance);

s_roots = GetRoots();

// We don't expose Roaming yet
// Helper.GetDataDirectory(IsolatedStorageScope.Roaming);
}

/// <summary>
/// Where the user's files go
/// </summary>
Expand Down

0 comments on commit 254242f

Please sign in to comment.