Make sure that the aliases that source the tcshrc still work

This commit is contained in:
Bernhard F.W. Gschaider 2014-08-01 01:15:57 +02:00 committed by Dominik Christ
parent 76d193a557
commit edc6952f57
2 changed files with 21 additions and 4 deletions

View file

@ -260,6 +260,11 @@ class CshConvert(ShellConvert):
pos=val.find("export ")
val=val.replace("export ","setenv ",1)
val=val[:pos]+val[pos:].replace("="," ",1)
# Prefix with a variable that tells the script that it is sourced from an alias
if val.find("source")>=0:
val=("setenv FOAM_SOURCED_FROM_ALIAS %s/tcshrc ; " % here)+val
return "alias %s '%s'" % (n,val)
class TcshConvert(CshConvert):

View file

@ -31,11 +31,23 @@
#
#------------------------------------------------------------------------------
set sourced=($_)
set thisScript=($sourced[2])
if ( $?FOAM_SOURCED_FROM_ALIAS ) then
# Sourced from an alias
set sourced=($_)
shift sourced
shift sourced
shift sourced
set thisScript=$FOAM_SOURCED_FROM_ALIAS
# Clear the variable to make sure regular sourcing still works
unsetenv FOAM_SOURCED_FROM_ALIAS
else
# regular sourcing
set sourced=($_)
set thisScript=($sourced[2])
shift sourced
shift sourced
endif
set thisDir=`python -c "from os.path import *;import sys;sys.stdout.write(dirname(abspath(join(curdir,'$thisScript'))))"`