#!/usr/bin/python2

import os, sys

if len(sys.argv) > 1:
	module = sys.argv[1]
	if os.path.exists("/usr/share/cinnamon/cinnamon-settings/modules/cs_%s.py" % module):
		os.execvp("/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", ("",) + tuple(sys.argv[1:]))
	elif os.path.exists("/usr/lib/cinnamon-control-center-1/panels"):
		os.execvp("/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", ("",) + tuple(sys.argv[1:]))
	elif os.path.exists("/usr/bin/gnome-control-center"):
		print "Unknown module %s, calling gnome-control-center" % module
		os.execvp("gnome-control-center", ("",) + tuple(sys.argv[1:]))
	else:
		print "Unknown module %s" % module
		os.execvp("/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", ("",) + tuple(sys.argv[1:]))
else:
	os.execvp("/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py", ("",) + tuple(sys.argv[1:]))

