Closed GoogleCodeExporter closed 9 years ago
Hello micolous,
I think I already found a relatively good solution to this problem.
The tarball already provides information on how to install the game as a
distribution
package. Please take a look at the INSTALL file and the stuff in the install/
folder.
The idea is to use a shell script that changes into the resource directory and
starts
the binary with ~/.config/pony.options as config file. If there is no such
config
file, it creates a copy from the resource folder automatically.
The main advantage of this aproach is that every user can have his/her local
config
file that can be changed without root privileges. This is crucial for the
settings
screen to work.
Take a look at the attached file listing for this arch linux PKGBUILD:
http://aur.archlinux.org/packages.php?ID=28350
/usr/bin/pink-pony is the shell-script. The real binary is
/usr/share/pink-pony/Pony.
What do you think about this solution?
Original comment by gin...@gmail.com
on 28 Aug 2009 at 8:23
Attachments:
Hi Ginquo,
I went for my solution mainly because it was what every other game on Gentoo
does,
with the exception of non-free games (which generally can't be modified to play
nicely in this fashion, and require similar shell-script hacks).
According to the Filesystem Hierarchy Standard, /usr/share should only contain
architecture-independent data (ie: no binaries). I've seen other software use
/usr/lib for holding programs that don't like to play nice.
I do agree though that the lack of settings saving abilities in the version
created
by my patch is a bad thing though, and that is something that needs to be
addressed
properly.
I think one other solution to integrating with Linux could be that it has a
fixed set
of paths to search for the configuration file in (eg: /etc/pink-pony,
~/.pink-pony/)
if no configuration file is specified, and having the "PONY_HOME" set as a
variable
in that file. So that if a relative file path is entered for a texture or other
data, it looks relative to PONY_HOME, and if an absolute path is entered, then
it
looks for that absolute file. This should also mean that all file paths that
are
presently hard coded must also go into that configuration file.
It would also allow for a user to install a "total conversion mod" of pink-pony
for
themselves without effecting other users, should such a day come when they
exist. 8)
--michael
Original comment by micol...@gmail.com
on 31 Aug 2009 at 12:14
If /usr/share may not contain binary files, then /usr/lib would probably be a
good
place to put the executable.
The FreeBSD port of pink-pony ( http://www.freshports.org/games/pink-pony/ )
put the
executable in /usr/libexec. This directory doesn't seem to be common in linux
distros, though.
The *nice* way to do it would probably be to make the working dir configurable
in the
config file and move there with chdir() in the main function. This would still
not
solve the problem of finding and creating the config file at the correct place.
There
is also the problem that chdir is not portable..
To be honest, I don't really see the problem with the current setup.
Shell-Script
wrappers in /usr/bin are very common. (Just test "grep -lm 1 "#\! /bin/sh"
/usr/bin/*" on your distro. I'm sure you will find quite a lot of scripts.)
It's also by far the easiest, most portable and least intrusive way to install
the
game as a distribution package.
The "every other game does that" argument is a bit weak. Putting the config
into /etc
is definately not a user friendly solution.
Original comment by gin...@gmail.com
on 1 Sep 2009 at 4:11
I'm not at all suggesting that the *only* configuration should be in /etc, I'm
just
saying that *a* configuration, the system-wide one, should be (just like every
other
application, game or not).
chdir seems only to be not portable to Windows, where it is _chdir instead.
Microsoft claim[1] this is ISO C++ compliant, unlike chdir. I can't find
anything in
my /usr/include about it outside of WINE and other compatibility headers.
I think to be able to handle the different operating systems' HOMEs properly,
it is
going to require a check function that is platform specific anyway, at least
for UNIX
vs. Windows Vista and earlier vs. Windows 7 (as there is a new
FOLDERTYPEID_SavedGames[2] for storing saved games).
[1]: <http://msdn.microsoft.com/en-us/library/ms235420%28VS.80%29.aspx>
[2]: <http://msdn.microsoft.com/en-au/library/bb762581%28VS.85%29.aspx>
Original comment by micol...@gmail.com
on 2 Sep 2009 at 1:25
If you want the master config file in /etc/, this can easily be done by editing
the
shell-script.
The script would then look something like this:
#!/bin/sh
cd /usr/share/pink-pony
if [ $# -ge 1 ]; then
/usr/lib/Pony $1
else
if [ ! -f ~/.config/pony.options ]; then
mkdir -p ~/.config/
cp /etc/pony.options ~/.config/pony.options
fi
/usr/lib/Pony ~/.config/pony.options
fi
This creates new config files from the master in /etc and calls the binary in
/usr/lib. No patches needed.
Original comment by gin...@gmail.com
on 4 Sep 2009 at 2:29
Attachments:
Okay, I'm closing this issue now.
I guess this wasn't what you wanted, but making all the paths
global/configurable
would have been too much work for too little benefit.
Sorry.
Original comment by gin...@gmail.com
on 21 Sep 2009 at 9:07
Original issue reported on code.google.com by
micol...@gmail.com
on 28 Aug 2009 at 5:00Attachments: