-
Notifications
You must be signed in to change notification settings - Fork 164
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
Optional Path for FlexibleSyncConfiguration isn't relative to App basePath #3383
Comments
It's also a minor inconvenience / inconsistency that Realm paths are relative to the CWD / Application.persistenDataPath, but App BasePaths default to that, but must be given as absolute paths. |
You're right - this is an oversight, but we can't really change it easily as that would be a breaking change for many users (as their Realms will now move to a potentially new location). As a workaround, you can specify the absolute path to the Realm instead. I can see we're missing some getters on the |
I put up #3385 that adds var realmPath = Path.Combine(app.BaseFilePath, "realm_path");
var config = new FlexibleSyncConfiguration(app.CurrentUser!, realmPath); I'm assuming this is sample code, but just in case, using hardcoded path for the Realm can be risky as you may end up with different users attempting to open the same file. This is why it's recommended that the Realm path incorporates the user id somewhere in there - e.g. |
I'm going to close this as not planned since we don't intend to change the behavior as that would be breaking. Once the new version is released, you should be able to more easily construct the absolute path relative to the app base path. |
What happened?
In Unity, creating a FlexibleSyncConfiguration with an optional path has that path Parented under Application.persistentDataPath, not the basePath that was given to the App.
Repro steps
Simple example scenario:
Expected: Realm Files are created in
$"{Application.persistentDataPath}/app_path/realm_path"
.Actual: Realm Files are in
$"{Application.persistentDataPath}/realm_path"
.Related: "mongodb-realm" directory is created under
$"{Application.persistentDataPath}/app_path"
as expected.Version
11.2.0
What Atlas Services are you using?
Both Atlas Device Sync and Atlas App Services
What type of application is this?
Unity
Client OS and version
Windows 11 x64 on Unity 2022.3.5f1
Code snippets
No response
Stacktrace of the exception/crash you're getting
No response
Relevant log output
No response
The text was updated successfully, but these errors were encountered: