#!/bin/csh -f -x
#*************************************************************************
# Copyright (c) 2002 The University of Chicago, as Operator of Argonne
# National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
# Operator of Los Alamos National Laboratory.
# This file is distributed subject to a Software License Agreement found
# in the file LICENSE that is included with this distribution. 
#*************************************************************************
#
# set default IDL_USERDIR
#

set dir=`pwd`
echo "PWD" $dir
if (-w $dir)  == 1  then 
	set IDL_USERDIR=$dir
	setenv IDL_USERDIR $IDL_USERDIR
	echo IDL_USERDIR $IDL_USERDIR
	exit
endif

if ${?IDL_USERDIR} == 0 then

		set IDL_USERDIR=$HOME/idl
		if -e $IDL_USERDIR then
		        if (-d $IDL_USERDIR )== 0 then
		        set IDL_USERDIR=$HOME
		        endif
		else
		        mkdir ${IDL_USERDIR}
		endif

endif

setenv IDL_USERDIR $IDL_USERDIR
echo IDL_USERDIR $IDL_USERDIR
