~mrms/tophat#39: 
Better path prefixes

Currently, paths work in the following way (which isn't documented anywhere):

Normally tophat will prepend the respath to the path. respath is empty by default, but can be modified using the -dir flag. If the user uses the raw:// prefix in the path, tophat will not modify the path.

Proposed solution:

  1. remove the respath logic altogether
  2. make the raw:// behavior default (raw:// will stay as an option for people who want to be explicit)
  3. Add the following prefixes:
    • res:// will evaluate to the resource directory of the game. By default that is the folder the main file is in
    • data:// will use a platform-dependent data storage path (%appdata%, ~/.local/share`).
Status
REPORTED
Submitter
~mrms
Assigned to
Submitted
1 year, 4 months ago
Updated
1 year, 2 months ago
Labels
ENHANCEMENT

~ske 1 year, 4 months ago

I support this

~mrms 1 year, 4 months ago

An interesting question arises: what folder should be used for the data:// prefix? More exactly, what comes after <platform_specific>/tophat/? All the games can't just share the same directory. There are various solutions I propose:

  1. Specify the game's name using an API function. th.setName("my_awesome_game")
  2. Guess it from something like the main.um's directory name
  3. Make some metadata file next to the main.um, this would open up many other possibilities.

What do you think ~ske?

ske@aaathats3as.com 1 year, 4 months ago ยท edit

I think the most explicit thing we can do is only allowing the user to use the data:// directory when they specify the name of the project in the flags. At some point, we might eventually need a project specification file.

Or maybe, find another solution.

We can make user be able to make their own protocols, by doing something like th.bind("data", th.appdata("project name")) this is a more versatile solution though less declarative.

Or hell, something even more generic, having the bind function execute a signal/callback which can allow for absolutely custom operations, like fetching something from the internet.

What are your thoughts?

~mrms 1 year, 4 months ago

I think the most explicit thing we can do is only allowing the user to use the data:// directory when they specify the name of the project in the flags. At some point, we might eventually need a project specification file.

Generally, I want to avoid the use of flags.

We can make user be able to make their own protocols, by doing something like th.bind("data", th.appdata("project name")) this is a more versatile solution though less declarative.

I don't think there will be that much use for this. If there is some protocol we find useful, it can always be part of tophat.


For now I'm going to go with the main.um's directory name, if that's ok with you.

~ske REPORTED CLOSED 1 year, 4 months ago

Totally ok!

~ske CLOSED REPORTED 1 year, 4 months ago

~ske 1 year, 4 months ago

Accidentally clicked resolve, my bad.

~mrms 1 year, 4 months ago

I've implemented the behaviour (it's in the path-prefix branch). Please test if it works correctly on windows.

Register here or Log in to comment, or comment via email.