EasyRPG / Player

RPG Maker 2000/2003 and EasyRPG games interpreter
https://easyrpg.org/player/
GNU General Public License v3.0
966 stars 183 forks source link

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

Open Ghabry opened 3 months ago

Ghabry commented 3 months ago

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

Ghabry commented 3 months ago

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