mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-24 20:27:40 +00:00
New wesnoth-defaults utility script
I wrote this a long time ago and have been using it to ease testing of Wesnoth's default configuration under different conditions ever since. It creates a new configuration and data directory under /tmp that only exists for the duration of the Wesnoth session, and disables WML cache functionality. This is extremely useful for quickly testing and debugging functionality dependant on user configuration settings.
This commit is contained in:
parent
9c53daa2a5
commit
164d632b54
47
utils/wesnoth-defaults
Executable file
47
utils/wesnoth-defaults
Executable file
@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Runs Wesnoth using a clean, throwaway config directory.
|
||||
#
|
||||
# The configuration directory is created on your temporary
|
||||
# directory (i.e. /tmp) with a unique name every time, and
|
||||
# deleted when finished.
|
||||
#
|
||||
# Usage:
|
||||
# wesnoth-defaults <command line>
|
||||
#
|
||||
# Examples:
|
||||
# wesnoth-defaults ~/src/wesnoth-1.12/wesnoth
|
||||
# wesnoth-defaults ~/src/wesnoth-1.12/wesnoth -s server.wesnoth.org
|
||||
# wesnoth-defaults ~/src/wesnoth-trunk/wesnoth-debug --campaign Heir_To_The_Throne
|
||||
#
|
||||
|
||||
SELF=`basename $0`
|
||||
|
||||
do_error()
|
||||
{
|
||||
echo "$SELF: $*" 1>&2
|
||||
}
|
||||
|
||||
if [ -z $1 ]; then
|
||||
do_error "You must specify a command line to run!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WESNOTH_BIN_PATH=$1
|
||||
TEMP_CONFIG_DIR=`mktemp -qd`
|
||||
|
||||
if [ -z $TEMP_CONFIG_DIR ]; then
|
||||
do_error "Could not create temporary dir before launch!"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
do_cleanup()
|
||||
{
|
||||
rm -rf $TEMP_CONFIG_DIR || do_error "Could not remove temporary config dir"
|
||||
}
|
||||
|
||||
trap do_cleanup INT QUIT HUP TERM EXIT
|
||||
|
||||
shift
|
||||
|
||||
$WESNOTH_BIN_PATH --nocache --userdata-dir $TEMP_CONFIG_DIR --userconfig-dir $TEMP_CONFIG_DIR $@
|
Loading…
x
Reference in New Issue
Block a user