# Utility function to set program arguments to a file name using a relative
# path (which is converted to be absolute to the project directory).
# This also converts backslashes to forward slashes on Windows.
# Intended to be run using the GHS Python Interpreter.

import re

if len(sys.argv) < 2:
    print 'Missing file argument'
    sys.exit(1)
self_dbw.RunCmd('mprintf("%s", _TOP_PROJECT_DIR)', printOutput=False)
if re.match("^win.*$", sys.platform):
    fixedPath=self_dbw.cmdExecOutput.replace('\\','/')
else:
    fixedPath=self_dbw.cmdExecOutput
self_dbw.RunCmd('setargs "'+fixedPath+'/'+sys.argv[1]+'"', printOutput=False)
