#!/usr/bin/python

#
# gSmile - emoticon manager
# 
# Copyright (C) 2005, Federico Pelloni <federico.pelloni@gmail.com>
#
#
# This program 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.
#
# This program 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 Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#

import sys
from os.path import join, realpath, isdir

prefix = realpath(join(sys.path[0], '..'))

try:
	import gsmile
	localrun = False
	
except ImportError:

	localrun = isdir(join(sys.path[0], 'src/gsmile'))

	if localrun:
		sys.path.insert(0, join(sys.path[0], 'src'))
	else:
		sys.path.insert(0, join(prefix, 'lib/python2.3/site-packages'))

	try:
		import gsmile
	except ImportError:
		print "Error: Unable to find gSmile libraries"
		sys.exit(1)


from gsmile.shared import gglobals

if localrun:
	prefix = ""
	gglobals.localrun = True
	gglobals.pixmapdir = "pixmaps/"
	gglobals.gladedir = ""
else:
	gglobals.pixmapdir = join(prefix, gglobals.pixmapdir)
	gglobals.gladedir = join(prefix, gglobals.gladedir)
	
gglobals.prefix = prefix

gsmile.start()
