#!/usr/bin/env python

import sys
import os


modules_path = os.path.dirname(os.path.abspath(sys.argv[0])).rstrip("/launch")

sys.path.insert(0, modules_path)
import processutils
processutils.update_sys_path(modules_path)

try:
    import projectmediaimport
    import editorstate # Used to decide which translations from file system are used
    root_dir = modules_path.split("/")[1]
    if root_dir != "home":
        editorstate.app_running_from = editorstate.RUNNING_FROM_INSTALLATION
    else:
        editorstate.app_running_from = editorstate.RUNNING_FROM_DEV_VERSION
except Exception, err:
    print "Failed to import projectmediaimport"
    print "ERROR:", err
    print "Installation was assumed to be at:", modules_path
    sys.exit(1)


projectmediaimport.main(modules_path, sys.argv[1]) # sys.argv[1] is a file path to project that is the media import target
