# Bryan Schumaker (8/7/2010)

import libsaria
import os

exists   = os.path.exists
is_dir   = os.path.isdir
expand   = os.path.expanduser
splitext = os.path.splitext
basename = os.path.basename
join     = os.path.join
makedir  = os.mkdir
rm       = os.remove
ls       = os.listdir
walk     = os.walk
sep      = os.sep
cwd      = os.getcwd
stat     = os.stat

cp         = None
saria_dir  = None
plugin_dir = None

shutil = None
FSTree = None
s_dir  = None
p_dir  = None

def file_id(path):
	if exists(path):
		return stat(path).st_ino
	return -1

def saria_dir_once():
	global s_dir
	global saria_dir
	s_dir = join(expand("~"), ".saria")
	if exists(s_dir) == False:
		mkdir(s_dir)
	saria_dir = saria_dir_rest
	return s_dir
def saria_dir_rest():
	global s_dir
	return s_dir
saria_dir = saria_dir_once

def cp_once(src, dest):
	global cp
	global shutil
	import shutil
	cp = shutil.copy
	cp(src, dest)
cp = cp_once

def mkdir(path):
	if not exists(path):
		makedir(path)
