Skip to content
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

Support "going up" from the working directory in the game browser #3203

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Ghabry
Copy link
Member

@Ghabry Ghabry commented Apr 1, 2024

Currently when starting the Player and the game browser launches you cannot go up from the working directory.

This is now working for the following cases (first commit):

  1. Project path is empty (working directory is used)
  2. Project Path is an absolute path.
  3. When Project path is not absolute the going up will end when the relative path ends. (fixing this edge-case is annoying, so I just gave up for now 🤷 )

No there is no special code for these 3 cases, the implementation just only works correctly for 1 and 2.


A bit more involved (second commit): When you can go fully up you will reach the drive letters on Windows.

I implemented this using a new virtual filesystem class DriveFilesystem and a new filetype FilesystemNode (which can returns an arbitrary VFS when selected). This filesystem is the parent of NativeFilesystem so you reach it when selecting .. at the highest location (c:/).

It is not attached as a parent when no drives are specified (= disabled under !Windows)

In theory this could be also hardcoded in NativeFilesystem (when going up from C:\ or / return a drive list) but we make some assumptions about how the root has to look (e.g. on the 3DS romfs: is not a valid directory but romfs:/ is. Therefore I decided to add an additional layer here just to not break any of our existing code.

This DriveFilesystem is flexible enough to also support more drives on other platforms later, implemented is only for Windows as here it is the most useful.

screenshot_2
screenshot_1

Is a virtual filesystem that lists drive letters on e.g. Windows.
The filesystem is deactivated on all other platforms right now.

Invented a new filetype "Filesystem" for delegation of the drive FS to the native FS.
This is kinda a hack but I couldn't think of a better way to add this...
@Ghabry
Copy link
Member Author

Ghabry commented Apr 1, 2024

I have to patch this out but it is currently possible to traverse the fake filesystem of emscripten: https://easyrpg.org/play/pr3203/?game=ageag :D

@Ghabry Ghabry added this to the 0.8.1 milestone Apr 1, 2024
@Ghabry Ghabry requested a review from fdelapena May 10, 2024 18:53
@Ghabry Ghabry marked this pull request as draft June 2, 2024 22:19
@Ghabry Ghabry removed this from the 0.8.1 milestone Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants