How to make Exult behave more like a native Mac OS X applica

NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Forum rules
NOTICE: This forum is archived as read only.
Please use the Github Discussions at https://github.com/exult/exult/discussions
Locked
richcon
Posts: 33
Joined: Thu May 14, 2020 1:34 pm

How to make Exult behave more like a native Mac OS X applica

Post by richcon »

I've been thinking about what would have to happen to make Exult behave more like a native Mac OS X application. This mainly has to do with where the various directories are put. Most of this would probably just involve changing the default config file.


Background:

On the Mac, the executable and all necessary resource files are encapsulated in a single Application bundle, which is a special direcotry but appears to be a single double-clickable program to the user, and can be moved around without messing anything up. (It's a very object-oriented way of thinking about programs.)

Any file that is necessary to run the program but that shouldn't be bundled with it directly (like the original Ultima 7 data files - they can be run from multiple builds of Exult, for instance) go in one of three places, depending on how many people are to access it:

~/Library/Application Support/ (for a single user)
/Library/Application Support/ (for a single computer)
/Network/Library/Application Support/ (for network installs)

And, preferences (which must be safely deletable and the program will recreate it) go in ~/Library/Preferences . It looks like Exult already puts the config file here.


So, here's where I think the specific directories should go:

1. The data/ directory should move to Exult.app/Contents/Resources/data/

2. The ~/.exult save game folder should move to ~/Library/Application Support/Exult/Save/

3. The game's STATIC directory should go in an Exult/Game Data folder in either /Library/Application Support or ~/Library/Application Support. (if not too much trouble, it'd be nice if Exult would check for game data in both places - the user's own Library first, then the computer's Library folder.) So for example, 's static directory could go in /Library/Application\ Support/Exult/Game\ Data/Ultima7/ .


Then, if you want to make it truly Mac-like (and would require actual changes to Exult's executable, so this isn't so necessary): add an option to the Exult main menu called "Install Game Data" that opens a file picker to choose the game folder for either Ultima 7 or Serpent Isle and copy it to the necessary location for you. If this feature isn't important to any platform other than the Mac, I could write an Applescript to do the install. It could be included in the Exult.app bundle (in the same folder as the exult binary), and a menu item in Exult could launch it.

Regards,
Rich
fingolfin
Site Admin
Posts: 41
Joined: Thu May 14, 2020 1:34 pm

Re: How to make Exult behave more like a native Mac OS X app

Post by fingolfin »

I agree with some of the things you said, and disagree with some others. (For background info: I am the OS X 'porter' of Exult, made the old OS 7/8/9 port, am developing for Macs for many years now and am very much familiar with the OS X file system layout guidelines, thank you :-). See also http://developer.apple.com/documentatio ... index.html

Yes, the data/ directory (containing things like exult_bg.flx) would best fit into the .app bundle, agreed. The main reason that it isn't is part lazyness :-/, part the fact that the automake/autoconf build system we use makes it really annoying to build a customized .app bundle. File a feature request for it on our RFE tracker, though, and I'll take a look at it.

The rest though, I don't agree with :-).

Save games are not application support data. The "Application Support" directory is mostly meant for static data, i.e. data which isn't changed and which is supplied along with the program itself, or installed by 3rd parties (think of Plugins)

Savegames however contain very personal data by the player. The player may want to backup them, etc.. As such the proper *default* location usually would be one of these:
* ~/Documents/Exult Savegames
* ~/Libraray/Preferences/Exult Savegames

Now you might counter that the file system specs quite clearly say: "Don’t Pollute User Space", specifically: "With the exception of the ~/Library directory, your application should never install files into the user’s home directory. In particular, you should never install files into a user’s Documents directory or into the /Users/Shared directory. These directories should only be modified by the user."

The problem here is that normally, the user can choose where to save his/her "documents", and in that case it's of course OK to store them in "Documents" (or whereever else the user chose). What makes this situation special is that there there is no "Save" dialog coming up when you save a game, rather, the game is stored in a (user configurable) fixed file system location.

As such, one can argue that it is OK to use a default location in ~/Documents -- fact is that the FS specs aren't really covering our situation at all :-/.



The other thing you mention is that the actual game data should be in "~/Library/Application Support". That one is controversial. On the one hand, yes, this is static support data, but not absolutely required for Exult to work (well, for Exult to be playable, it is, of course, but you could use SI w/o BG or vice versa -- ahe well, I guess you get the idea, and besides I think this was the pointed you wanted to make yourself anyway :-).

However, this indeed requires work by the user, as you describe. What *I* think would be best was if Exult simply offered a config dialog where you can see the paths configured for BG/SI, and a "Choose" button next to each which lets you pick the location of the BG/SI data. No need to "copy" it to Application Support or any other place, just let the user specify where they are!
richcon
Posts: 33
Joined: Thu May 14, 2020 1:34 pm

Re: How to make Exult behave more like a native Mac OS X app

Post by richcon »

Fingolfin,

Thanks for the response! (And thanks for maintaining the Mac port of Exult, I've had a great time playing with it.)

You're right about the save game files, they probably shouldn't go in ~/Library/Application Support. They shouldn't go in Documents either, for the same reasons you mentioned.

Programs that maintain their own save files (like Mail and Address Book, etc) generally put them in ~/Library. The hard part is figuring out where. (Most programs just create their own subfolders of Library, i.e. Library/Mail and Library/Addresses, when nowhere else is appropriate.) It definitely shouldn't go in Library/Preferences, because anything in there is supposed to be easily deletable if something goes wrong with the program. So maybe the best place is ~/Library/Exult. (I'd rather there were a subdirectory that would better fit it, since I don't like polluting the Library folder. I'm just pointing out that's where this kind of stuff seems to go.)

As for actual game data, it's precisely the kind of thing that Application Support is meant for. There's no rule that Application Support must *never* change - as you mentioned, third party plugins (Origin is a third party here) or other optional application data go there too. That sounds like game data to me. I'm fine with giving users the option to store their game data wherever they want, but I do think the default should be there. (I think most users would rather the stuff be appropriately filed away, than sitting in their home folder where they first copied it to!)

It does take a little bit of work to move files there, but the amount of work people have to do now to play both Black Gate and Serpent Isle on the mac is even more. It would be trivial to create an Applescript to take care of putting files where they belong for the user, and I can do that part if you'd like.

Regards,
Rich
richcon
Posts: 33
Joined: Thu May 14, 2020 1:34 pm

Re: How to make Exult behave more like a native Mac OS X app

Post by richcon »

(Just to clarify, while ~/Library/Exult might not be optimal for the save games, it's still better than putting invisible folders into the user's home directory. At least here people will be able to easily find it, and it is consistent with how other applications behave.)
richcon
Posts: 33
Joined: Thu May 14, 2020 1:34 pm

Re: How to make Exult behave more like a native Mac OS X app

Post by richcon »

I've posted it to the feature tracker:

http://sourceforge.net/tracker/index.ph ... tid=352335
Locked