saved files path not used with Snow Leopard

Discussion and announcements regarding the Mac port… er, original version of Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

saved files path not used with Snow Leopard

Post by Eric Walch »

A few weeks ago I also installed Oolite on my new mac that runs under Snow Leopard. However, for some unknown reason the save path is not used, but always defaults to "~/Documents". Every time I want to open (or save) a file I have to navigate trough all folders to reach my Oolite save folder. It both happens in Windowed mode as with full screen. I checked in oolites preference files. There it has stored the correct path to my save folder, it just is not using the path. It happens both with 1.74.2 as with newest trunk.

The computer were I normally play Oolite runs under Leopard. There everything works as it should.

The new mac with Snow Leopard has nothing special installed, so I am wondering if it are settings with me that I missed or is the problem in Oolite?
User avatar
maik
Wiki Wizard
Wiki Wizard
Posts: 2028
Joined: Wed Mar 10, 2010 12:30 pm
Location: Ljubljana, Slovenia (mainly industrial, feudal, TL12)

Post by maik »

Where does it save? I also run Snow Leopard and it always saves to ~/oolite-saves/

I didn't change any settings though, didn't even know I can configure the save path...

When I want to start Oolite with my saved game I always use the cmd-space (Spotlight) shortcut to find a file, type the first few chars and hit enter. That way I don't have to navigate via Finder. The .oolite-save extension is linked to the Oolite application on Macs so it open automatically.
User avatar
Uncle Reno
---- E L I T E ----
---- E L I T E ----
Posts: 648
Joined: Mon Apr 24, 2006 12:54 pm
Location: UK

Post by Uncle Reno »

As far as I can recall I've always saved in ~/Documents/My name/, just checked and that's where Oolite (1.74.2) defaults to, but could that be something I changed? :?
"Get back or I unleash my lethal spotted batoid!!"

What I do when not reading the Oolite bulletin board!
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Uncle Reno wrote:
As far as I can recall I've always saved in ~/Documents/My name/, just checked and that's where Oolite (1.74.2) defaults to, but could that be something I changed? :?
Oolite should default to the last directory used for saving. At least that was what it always did for me. I regularly save in a different directory and it than always defaulted to that one when I loaded a new game.

However, on my new mac I have to select the path every time again. And I checked the preference file. There is an entry "save-directory" that holds the path to the last used save file. That path is updated correctly when I save in a different folder. It is just Oolite not using this path as I was used on my normal mac.

I was just wondering if it is something SL is overruling, a setting I should change or a plain Oolite bug.
maik wrote:
Where does it save? I also run Snow Leopard and it always saves to ~/oolite-saves/
At least that means it is not SL but something else that breaks it with me. And launching Oolite by the save file is no option for me as I than don't know which Oolite it will launch. I have 1.55 till 1.74 installed and several Trunk versions. (I know I can set the default application but I regularly switch between 1.74 and trunk)
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

I got frustrated to set the load or save path for every time I wanted to load or save a file. So I have been browsing through the code to find a cause. In "PlayerEntityLoadSave.m" I find in the macSpecific functions:

Code: Select all

result = [oPanel runModalForDirectory:nil file:nil types:fileTypes];
When I change it to

Code: Select all

result = [oPanel runModalForDirectory:save_path file:nil types:fileTypes];
My path suddenly gets remembered. Not on the first open, but with all following open or save trials. Even the load/save dialog for the full screen now starts with the last used directory.

One problem for further testing though: When I reverted the code to the old situation, my save path was still remembered and the dialogs started with the correct folder as I would like.
Than I used my original 1.74.2 Oolite. And even that version now started using the correct paths. But this makes it impossible to do further testing.

Seeing that I originally had path problems, suggest that there probably are others with similar problems. So maybe the path should be added to the "runModalForDirectory:save_path"?
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Looking for the exact working of the "runModalForDirectory" command on apples site I noticed that this library command is marked as "deprecated" for OSX 10.6. look here. So maybe just adding the path would not be enough for the future and we need a new library command here?
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

As it says on that page, all we need to do to be future proof is to change

Code: Select all

result = [oPanel runModalForDirectory:save_path file:nil types:fileTypes];
to

Code: Select all

[oPanel setDirectoryURL:save_path];
[oPanel setAllowedFileTypes:fileTypes];
result = [oPanel runModal];
Still, we might want to avoid the modal bit completely... if we do that we'll have the same load/save file look across all platforms, both in full screen & windowed mode... :)
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Kaks wrote:
As it says on that page, all we need to do to be future proof is to change
...
to

Code: Select all

[oPanel setDirectoryURL:save_path];
[oPanel setAllowedFileTypes:fileTypes];
result = [oPanel runModal];
if (result == NSFileHandlingPanelOKButton)
{
	return [self loadPlayerFromFile:[oPanel filename]];
}
Still, we might want to avoid the modal bit completely... if we do that we'll have the same load/save file look across all platforms, both in full screen & windowed mode... :)
Yes, that alternative above (with a changed result) I already tested yesterday and works exactly like the old situation. The only problem I saw is that setDirectoryURL:save_path is only valid since snowLeopard and can't be used yet. But in the current situation the path was never transmitted so we probably don't need it. I installed Oolite by copying it from one computer to the other. Probably that gave the path problem. Maybe when I would have used the installer, the mac itself would have beep keeping record of the path itself from the start, like it does now.

The last (and only time) I wrote modal load/save dialogs was for OS6 in Pascal (20 years ago) Things have changed completely since and all my many kgs of my old inside mac books are useless now. :cry: I better leave this to those with more recent knowledge of the mac OS.
User avatar
maik
Wiki Wizard
Wiki Wizard
Posts: 2028
Joined: Wed Mar 10, 2010 12:30 pm
Location: Ljubljana, Slovenia (mainly industrial, feudal, TL12)

Post by maik »

Kaks wrote:
Still, we might want to avoid the modal bit completely... if we do that we'll have the same load/save file look across all platforms, both in full screen & windowed mode... :)
I would prefer that. It always struck me as odd seeing the OS X file dialog in windowed mode which rather rudely yanks me out of the game.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

maik wrote:
Kaks wrote:
Still, we might want to avoid the modal bit completely... if we do that we'll have the same load/save file look across all platforms, both in full screen & windowed mode... :)
I would prefer that. It always struck me as odd seeing the OS X file dialog in windowed mode which rather rudely yanks me out of the game.
Personally I've never seen anything else (cause I only ever play on a Mac in windowed mode), and so I'm used to it. In fact I only learned from the boards that Oolite even has something different than the OS X file dialog. :shock:
Post Reply