import os

# import variables
Import('env', 'opts', 'data_dir')

def install_dir(file):
	"""Recursive SCons directory install"""
	if os.path.isdir(file):
		if file.find('.svn') >= 0:
			return
		else:
			subfiles = os.listdir(file)
			for subfile in subfiles:
				install_dir(os.path.join(file, subfile))
	else:
		dest = os.path.split(os.path.join(data_dir, file))[0]
		env.Install(dest, file)
		env.Alias('install', dest)

dirs = ('font', 'img', 'xml')
# install
if data_dir != '':
	for dir in dirs:
		install_dir(dir)
