Issue520

Title lvledit: save maps to ~/.freedroid_rpg/maps if no writing rights to /usr/share/freedroidRPG/maps/levels.dat
Priority important Status resolved
Assigned To ahuillet Keywords editor
Linked issues make it possible to save maps to /.freedroid_rpg
View: 297
Watchers

Submitted on 2011-11-04 06h39 by matthiaskrgr, last changed by ahuillet.

Messages
Author: matthiaskrgr Date: 2011-11-04   06h39
When I had freedroidRPG installed as distro package and tried to save a map
using the editor, the game crashed because it couldn't write the modified map to
/usr/share/freedroidRPG/maps/... since I didn't run freedroidRPG as root.

I filed a bug report for that crash, and the guys made the level editor
inaccessible. :/


I think a proper solution is to detect if we cannot write to /usr/... and
instead save the mapfile to the freedroid_rpg data directory in ones home dir
(where the cfg and savegames are saved.)
~/.freedroid_rpg/maps/ sounds like a good idea to me (if we can get the game to
have several maps saved.)
Author: ahuillet Date: 2011-11-04   07h18
It's not "the guys" but "FreedroidRPG debian package's maintainer". They're
several crazy people but it's not the whole world.

At any rate - your suggested behavior is sound. I think we can do it quickly but
I wouldn't hold my breath about this going in 0.15. The issue has been there for
a decade, you're not going to convince me that all of a sudden it's that
important. :)
Author: matthiaskrgr Date: 2011-11-05   21h14
Well, the I remember the debian guy "removing" (actually just hiding as I
suppose now) the editor, this is shouldn't happen again imo.
Author: salimiles Date: 2011-11-05   23h15
What would be easiest is to put up an alert when the editor opens up and the
player cannot write to the current ship.

Of course, Matthias' solution would be *better*.
Author: matthiaskrgr Date: 2011-11-06   06h58
Yes, an alert window is the minimum we should have. :)
Author: salimiles Date: 2011-11-07   01h31
Ok, http://rb.freedroid.org/r/1598/ now addresses this pretty completely, IMHO:

1) If you can save to the map/ directory it allows you to, with no warnings

2) If you can't save to map/ but you can save to ~/.freedroid_rpg, it warns you
at editor start, and when you save. But now it will save there.

3) It you can't save to either map/ or ~/.freedroid_rpg, it warns and pops out a
debug error telling you, and will not allow you to save at all.

So yeah, it gets rid of the crashes and provides graceful failure.
Author: fluzz Date: 2011-11-07   08h21
On 11/07/2011 02:31 AM, salimiles - Roundup wrote:
>
> salimiles<stinkyfishheadisred@yahoo.com>  added the comment:
>
> Ok, http://rb.freedroid.org/r/1598/ now addresses this pretty completely, IMHO:
>
> 1) If you can save to the map/ directory it allows you to, with no warnings
>
> 2) If you can't save to map/ but you can save to ~/.freedroid_rpg, it warns you
> at editor start, and when you save. But now it will save there.
>
> 3) It you can't save to either map/ or ~/.freedroid_rpg, it warns and pops out a
> debug error telling you, and will not allow you to save at all.
>
> So yeah, it gets rid of the crashes and provides graceful failure.

But, how to load the ship file saved in ~/.freedroid_rpg ?
Author: salimiles Date: 2011-11-08   01h50
Currently game only loads ship files that are saved to 'map/', so in order to
load the ship file, you have to move it there. Probably by hand.

If you are saving to ~/.freedroid_rpg/, it means for some reason the game could
not write to "map/", meaning that you probably need to move it as super-user.

That is why I wrote the patch with several warnings about it saving to
~/.freedorid_rpg/ .



We could, of course, do the following on game load:
1) look an see if we have a local ship file saved to ~/.freedroid_rpg/ (e.g.
sprintf(map, "%s/%s", our_config_dir, "levels.dat"); if (access(map, R_OK)) {
prompt();}
2) if we have such a file, as the user if they want to use that one instead
3) if yes to both, load the local ship file

But I think that would be a separate patch (at the very least we would need to
have an OK/Cancel prompt, but we need one of those anyways).
Author: salimiles Date: 2011-11-15   20h24
Apparently issue 297 is currently the same...
Author: salimiles Date: 2011-11-19   17h40
Assigning to Arthur, as he seems to have a clear idea of what he wants (and it
is not rb1598 ).
Author: ahuillet Date: 2011-11-20   12h02
Fixed in r5165.
History
Date User Action Args
2011-11-20 12:02:57ahuilletsetstatus: open -> resolved
messages: + msg2040
2011-11-19 17:40:03salimilessetassignedto: ahuillet
messages: + msg2028
2011-11-15 21:06:33salimilessettitle: editor: save maps to ~/.freedroid_rpg/maps if no writing rights to /usr/share/freedroidRPG/maps/levels.dat -> lvledit: save maps to ~/.freedroid_rpg/maps if no writing rights to /usr/share/freedroidRPG/maps/levels.dat
2011-11-15 20:24:35salimilessetmessages: + msg1986
linked: + make it possible to save maps to /.freedroid_rpg
2011-11-15 20:23:59salimileslinkissue297 linked
2011-11-09 22:51:22salimileslinkissue529 linked
2011-11-08 01:50:34salimilessetmessages: + msg1941
2011-11-07 08:21:03fluzzsetmessages: + msg1936
2011-11-07 01:31:59salimilessetmessages: + msg1923
2011-11-06 06:58:32matthiaskrgrsetmessages: + msg1911
title: editor: save mape to ~/.freedroid_rpg/maps if no writing rights to /usr/share/freedroidRPG/maps/levels.dat -> editor: save maps to ~/.freedroid_rpg/maps if no writing rights to /usr/share/freedroidRPG/maps/levels.dat
2011-11-05 23:15:22salimilessetmessages: + msg1908
2011-11-05 21:14:31matthiaskrgrsetmessages: + msg1905
2011-11-04 07:18:54ahuilletsetmessages: + msg1887
2011-11-04 06:39:29matthiaskrgrcreate