CC Zone - Chip's Challenge Forum
Tile World file location help (Linux) - Printable Version

+- CC Zone - Chip's Challenge Forum (https://forum.bitbusters.club)
+-- Forum: Chip's Challenge (https://forum.bitbusters.club/forum-4.html)
+--- Forum: General Discussion (https://forum.bitbusters.club/forum-13.html)
+--- Thread: Tile World file location help (Linux) (/thread-1455.html)



Tile World file location help (Linux) - Flexico - 08-Sep-2015

I installed the "tworld" package with APT, but it stores some files in "~/.tworld" like I would expect, but others (level sets and resource files) in "/usr/share/games/tworld". I would like everything to be in "~/.tworld", and I read somewhere in the documentation that I can specify different folders, but I can't find how to actually do it. Help please?


Tile World file location help (Linux) - chipster1059 - 08-Sep-2015

For that you have to compile Tile World yourself, the package you installed is useless, you have to uninstall it.

Download the source code here:

www.muppetlabs.com/~breadbox/pub/software/tworld/tworld-1.3.1-CCLPs.tar.gz

Extract it.

Open a terminal and navigate to the directory where you extracted the tarball. Run the following command:

./configure --with-sharedir=AAA

Replace AAA with the full path to the directory where you want the files to be stored.

Then run the following command:

make

Finally, run this command as root:

make install

And it should work. Hope this helps.


Tile World file location help (Linux) - breadbox - 08-Sep-2015

You have a few options.

  1. You can set the environment variable TWORLDDIR to change the default directory tree for all shared files. So you could add something like this to your .profile (or .bash_profile or whatever you use):

    export TWORLDDIR=~/.tworld

    <span style="font-family:arial, helvetica, sans-serif;"><span style="font-family:'courier new', courier, monospace;"><span style="font-family:arial, helvetica, sans-serif;"><span style="font-family:'courier new', courier, monospace;"><span style="font-family:arial, helvetica, sans-serif;">Note that this will create ~/.tworld/data, ~/.tworld/sets, and ~/.tworld/res, but your save files will still be in the top-level ~/.tworld directory, which is a little messy. But there's also a TWORLDSAVEDIR environment variable you can use, which will just change the default save directory. So you could do this:

    <span style="font-family:'courier new', courier, monospace;">export TWORLDDIR=~/.tworld
    export TWORLDSAVEDIR=~/.tworld/save



    which would probably be the closest to what you want.
  2. You can use command-line options -D, -L, and -R (and optionally also -S) to override the default directories individually:

    tworld -D datadir -L setsdir -R resdir -S savedir

    To avoid having to type all that out, you could create a tworld shell script in your personal bin directory that looked something like this:

    <span style="font-family:'courier new', courier, monospace;">#!/bin/sh
    DIR=~/.tworld
    tworld -D $DIR/data -L $DIR/sets -R $DIR/res -S $DIR/save



    Note that you can use the command "tworld -h" to see a full list of the command-line options, or "man tworld" to see more detailed documentation. Or the same documentation is available on the website.
  3. Finally, of course, you can compile Tile World yourself, and configure the default directories to be the way you want them to be. That's not as convenient, of course.




For the record, Tile World's file layout follows the standard Unix behavior of putting universal data (the level sets, sounds and graphics) in a shared location, and the user-specific data (your solutions) in a user-specific location.


Tile World file location help (Linux) - Flexico - 08-Sep-2015

Alright, I tried compiling it myself, but I get this error:


[Click to Show Content]



Tile World file location help (Linux) - Flexico - 08-Sep-2015

And yes, I am aware why the files are structured that way -- but I like to tinker with the data/res files, and my home folder is mounted to a separate partition that is shared by multiple Linux installs, so my settings are preserved even if I wipe and reinstall a distro or two. That way I don't have to re-widger the /usr/share stuff on each one.


Tile World file location help (Linux) - Flexico - 08-Sep-2015

Ok, got it working with the command line options! Woohoo! I would still like to learn how to compile it myself though, and know what went wrong.


Tile World file location help (Linux) - breadbox - 08-Sep-2015

What went wrong is that you don't have the SDL development package. (You have SDL installed, but you don't have the support files that let you build something that uses SDL.) Running "sudo apt-get install libsdl1.2-dev" would fix that.


Tile World file location help (Linux) - breadbox - 08-Sep-2015

(Oh, and I would say that your use case is exactly the type of situation I had in mind when I added the environment variables feature to Tile World.)