-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
74642 change isostorage path #75541
Merged
mkhamoyan
merged 12 commits into
dotnet:main
from
mkhamoyan:74642_change_isostorage_path
Sep 27, 2022
Merged
74642 change isostorage path #75541
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9034496
#74642 changed isolatedstorage path
mkhamoyan 9878272
Merge branch 'main' into 74642_change_isostorage_path
mkhamoyan b5fd07f
#74642 Refactored and changed root only for mobile
mkhamoyan 5732db6
#74642 minor changes
mkhamoyan 254242f
#74642 removed redundunt code
mkhamoyan b828032
#74642 rename IsolatedStorageDirectoryName
mkhamoyan 37140e3
#74642 change also in comments
mkhamoyan ff6cadb
#74642 changed IsolatedStorageDirectoryName for only mobile
mkhamoyan 3bf593a
#74642 done minor changes
mkhamoyan d5b2414
#74642 made IsolatedStorageDirectoryName const
mkhamoyan 4f2e3fd
#74642 removed whitespaces
mkhamoyan 0f8c243
#74642 fix csproj for linux
mkhamoyan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/libraries/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/Helper.AnyMobile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.IO.IsolatedStorage | ||
{ | ||
internal static partial class Helper | ||
{ | ||
public const string IsolatedStorageDirectoryName = ".isolated-storage"; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/libraries/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/Helper.NonMobile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.IO.IsolatedStorage | ||
{ | ||
internal static partial class Helper | ||
{ | ||
public const string IsolatedStorageDirectoryName = "IsolatedStorage"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
.../System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageFile.AnyMobile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.IO.IsolatedStorage | ||
{ | ||
public sealed partial class IsolatedStorageFile : IsolatedStorage, IDisposable | ||
{ | ||
private string GetIsolatedStorageRoot() | ||
{ | ||
return Helper.GetRootDirectory(Scope); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
.../System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageFile.NonMobile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Text; | ||
|
||
namespace System.IO.IsolatedStorage | ||
{ | ||
public sealed partial class IsolatedStorageFile : IsolatedStorage, IDisposable | ||
{ | ||
private string GetIsolatedStorageRoot() | ||
{ | ||
StringBuilder root = new StringBuilder(Helper.GetRootDirectory(Scope)); | ||
root.Append(SeparatorExternal); | ||
root.Append(IdentityHash); | ||
mkhamoyan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
return root.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...braries/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/TestHelper.AnyMobile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Reflection; | ||
using System.Collections.Generic; | ||
|
||
namespace System.IO.IsolatedStorage | ||
{ | ||
public static partial class TestHelper | ||
{ | ||
private static List<string> GetRoots() | ||
{ | ||
List<string> roots = new List<string>(); | ||
string userRoot = Helper.GetDataDirectory(IsolatedStorageScope.User); | ||
string randomUserRoot = Helper.GetRandomDirectory(userRoot, IsolatedStorageScope.User); | ||
roots.Add(randomUserRoot); | ||
|
||
// Application scope doesn't go under a random dir | ||
roots.Add(userRoot); | ||
return roots; | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...braries/System.IO.IsolatedStorage/tests/System/IO/IsolatedStorage/TestHelper.NonMobile.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Reflection; | ||
using System.Collections.Generic; | ||
|
||
namespace System.IO.IsolatedStorage | ||
{ | ||
public static partial class TestHelper | ||
{ | ||
private static List<string> GetRoots() | ||
{ | ||
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); | ||
|
||
roots.Add(Path.Combine(randomUserRoot, hash)); | ||
// Application scope doesn't go under a random dir | ||
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) | ||
{ | ||
roots.Add(Helper.GetDataDirectory(IsolatedStorageScope.Machine)); | ||
} | ||
|
||
return roots; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
|
||
namespace System.IO.IsolatedStorage | ||
{ | ||
public static class TestHelper | ||
public static partial class TestHelper | ||
{ | ||
private static PropertyInfo s_rootDirectoryProperty; | ||
private static List<string> s_roots; | ||
|
@@ -17,27 +17,8 @@ static TestHelper() | |
{ | ||
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, '.'); | ||
|
||
string userRoot = Helper.GetDataDirectory(IsolatedStorageScope.User); | ||
string randomUserRoot = Helper.GetRandomDirectory(userRoot, IsolatedStorageScope.User); | ||
s_roots.Add(Path.Combine(randomUserRoot, hash)); | ||
|
||
// Application scope doesn't go under a random dir | ||
s_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)); | ||
} | ||
|
||
s_roots = GetRoots(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What tests are failing if this isn't changed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As roots are different for mobile and non mobile platforms I needed to implement differently for them. |
||
|
||
// We don't expose Roaming yet | ||
// Helper.GetDataDirectory(IsolatedStorageScope.Roaming); | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the
mono
implementation you linked the code appends.isolated-storage
at the very end and I can't see it anywhere in your PR. Is that done somewhere else?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is done in https://github.com/dotnet/runtime/blob/main/src/libraries/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/Helper.Win32Unix.cs#L26 ,https://github.com/dotnet/runtime/blob/main/src/libraries/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/Helper.cs#L8
but thanks for noticing I need to change to previous name as now it will be /IsolatedStorage/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the latest change will change the behavior of all platforms, not just the mobile ones, right? I'm not sure if that's something we can/should do, because it could lead to the same problem just on different platforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does
.config
get appended to the path on mobile ifIsolatedStorageDirectoryName
is just.isolated-storage
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in all cases config is appended
( in legacy mono also https://github.com/mono/mono/blob/b40e9939a7d07b30a75625692874f02bcc9be18f/mcs/class/corlib/System/Environment.cs#L623 ). During testing I noticed in some cases there was .config added and I think it was done by GetDataDirectory , it will be included in dataDirectory https://github.com/dotnet/runtime/blob/main/src/libraries/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/Helper.Win32Unix.cs#L26