-
Notifications
You must be signed in to change notification settings - Fork 50
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
File system mocking #168
Comments
In regard to #149, #150 and #151: some form of virtualization or redirection is required for good Wine support. As an example: public AbsolutePath GetSavesFolder()
{
return KnownFolders.AppData.CombineUnchecked("SomeGame");
} With how things are currently, this code will return This comes with some challenges:
The last point is important, so we don't end up having to change everything. A simple drop-in replacement, that doesn't change the code example above, would be ideal. However, since a bunch of utilities, like |
Not really much to say here; this pretty much lines up with what I've been saying on Slack for a while; so it's nice to have this more immortalised as a comment. Especially with the last comment. We can't realistically expect developers adding support for individual games to test/write code for non-Windows (sadly), so being able to support non-Windows platforms in a way where plugin/game extension developers are unaware of other OSes would be ideal. |
This all makes sense to me, and I think the hardest part all of this will be the rather massive rewrite of the codebase. But I guess we can do this a bit piecemeal by first adding a method to the filesystem interface, then remove the matching function from We probably want a custom interface for this though, so that we can pass |
One more caveat in regard to Proton: the default user of Proton-managed Wine prefixes is |
@erri120 does this sound like something you can tackle? I think we have a pretty solid grip on the design, and I outlined some basic points in the ticket's description |
I can start working on this and create a draft PR |
Currently, we use the real file system everywhere. While this makes it easier to implement features, it also makes it harder to write meaningful unit tests. Here are a couple options:
Design
AbsolutePath
types and return our app value types, for example, returnSize
instead ofulong
,IFileSystem
interfaceIFileSystem
as a parameter type toAbsolutePath
.AbsolutePath
to access the filesystem viaIFileSystem
. Most of the time we shouldn't need to add aIFilesystem
parameter in the rest of the app. If we have anAbsolutePath
in a given context we can use theIFileSystem
from that path, instead of requiring it as an input to the user-code function.IFileSystem
as an additional parameter/componentIFileSystem
in the DI framework so we can import it into any componentThe text was updated successfully, but these errors were encountered: