# -*- coding: utf-8 -*-
#
# defaults.py.in sets many important default global variables
# used throughout the game. Note that this file is processed by
# automake to set prefix paths etc. Please keep defaults.py.in
# in sync between glchess and gnome-sudoku. 

import sys, os
import errno
import locale
import gettext

root_dir = os.path.dirname(os.path.dirname(__file__))
if not os.path.exists(os.path.join(root_dir, "Makefile.am")):
    # Running in installed mode
    APP_DATA_DIR = os.path.join('/usr', 'share')
    BASE_DIR = os.path.join(APP_DATA_DIR, 'gnome-sudoku')
    IMAGE_DIR = os.path.join(BASE_DIR, 'images')
    LOCALEDIR = os.path.join(APP_DATA_DIR, 'locale')
    UI_DIR = BASE_DIR
    PUZZLE_DIR = os.path.join(BASE_DIR, 'puzzles')
else:
    # Running in uninstalled mode
    sys.path.insert(0, os.path.abspath(root_dir))
    APP_DATA_DIR = os.path.join(root_dir, '../data') 
    IMAGE_DIR    = os.path.join(root_dir, '../images')
    LOCALEDIR    = os.path.join(APP_DATA_DIR, 'locale')
    UI_DIR    = os.path.join(root_dir, '../data')
    BASE_DIR     = os.path.join(root_dir, '../data')
    PUZZLE_DIR   = BASE_DIR

DOMAIN = 'gnome-games'
locale.bind_textdomain_codeset(DOMAIN, "UTF-8") # See Bug 608425
gettext.bindtextdomain(DOMAIN, LOCALEDIR)
gettext.textdomain(DOMAIN)
from gettext import gettext as _

VERSION = "2.32.1"
APPNAME = _("GNOME Sudoku")
APPNAME_SHORT = _("Sudoku")
COPYRIGHT = 'Copyright \xc2\xa9 2005-2008, Thomas M. Hinkle'
DESCRIPTION = _('GNOME Sudoku is a simple Sudoku generator and player. Sudoku is a Japanese logic puzzle.\n\nGNOME Sudoku is a part of GNOME Games.')
AUTHORS = ["Thomas M. Hinkle"]
WEBSITE       = 'http://www.gnome.org/projects/gnome-games/'
WEBSITE_LABEL = _('GNOME Games web site')
AUTO_SAVE = True
MIN_NEW_PUZZLES = 90

# The GPL license string will be translated, and the game name inserted.
# This license is the same as in libgames-support/games-stock.c 
LICENSE = [_("%s is free software; you can redistribute it and/or modify " 
       "it under the terms of the GNU General Public License as published by " 
       "the Free Software Foundation; either version 2 of the License, or " 
       "(at your option) any later version.").replace("%s", APPNAME),
_("%s is distributed in the hope that it will be useful, "
       "but WITHOUT ANY WARRANTY; without even the implied warranty of "
       "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the "
       "GNU General Public License for more details.").replace("%s", APPNAME),
_("You should have received a copy of the GNU General Public License "
       "along with %s; if not, write to the Free Software Foundation, Inc., "
       "51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA").replace("%s", APPNAME)]

DATA_DIR = os.path.expanduser('~/.gnome2/gnome-sudoku/')

def initialize_games_dir ():
    try:
        os.makedirs(DATA_DIR)
    except OSError, e:
        if e.errno != errno.EEXIST:
            print _('Unable to make data directory %(dir)s: %(error)s') % {'dir': DATA_DIR, 'error': e.strerror}
