mirror of
https://github.com/elliotnunn/BuildCubeE.git
synced 2026-01-23 19:16:18 +00:00
70 lines
3.0 KiB
Plaintext
70 lines
3.0 KiB
Plaintext
# File: Directory2
|
|
#
|
|
# Copyright Apple Computer, Inc. 1991
|
|
# All rights reserved.
|
|
#
|
|
#
|
|
# Scripts that have Projector commands within them can normally not be
|
|
# executed by ToolServer. Using SourceServer, the RProj tool, and three support
|
|
# scripts (AliasSourceServer, UnaliasSourceServer, and Directory2), ToolServer
|
|
# can perform Projector functions. SourceServer must be running on the same
|
|
# computer as ToolServer before the Projector scripts can be executed.
|
|
# Individual Projector command lines are sent from ToolServer to SourceServer
|
|
# via AppleEvents by the RProj tool. To allow RProj to automatically be invoked
|
|
# any time a Projector command is encountered, we use the AliasSourceServer
|
|
# script to alias each ProjectorCommand to "RProj ProjectorCommand". To make
|
|
# sure that the aliases remain in effect even after the AliasSourceServer script
|
|
# has finished running, we must use the command line, "Execute AliasSourceServer".
|
|
# Directory commands also need to be aliased to Directory2, which will keep the
|
|
# current directory of both ToolServer and SourceServer set to the same location
|
|
# so both Projector and non-Projector commands operate on the same set of files.
|
|
# This alias is also established by the AliasSourceServer script. Finally, after
|
|
# completion of the Projector commands, "Execute UnaliasSourceServer" restores
|
|
# ToolServer to it's normal operation.
|
|
#
|
|
# This file, Directory2, is one of the support scripts.
|
|
|
|
# Prior to calling Directory2, the AliasSourceServer script has executed
|
|
# "Alias Directory Directory2". Within this script, we will use the built-in
|
|
# command, Directory, so we must unalias it to restore normal operation. The
|
|
# Unalias command has local scope, so upon exiting this script, the alias to
|
|
# Directory2 will be back in force!
|
|
|
|
Unalias Directory
|
|
|
|
# The parameters for the original call to Directory remain the parameters
|
|
# for Directory2 also. We must now parse them and make sure the desired action
|
|
# takes place both for ToolServer and SourceServer:
|
|
|
|
if {#} == 0
|
|
|
|
# "Directory", with no parameters, means to echo the current directory that
|
|
# the ToolServer script is executing in. For this we could just unalias directory
|
|
# and then make the call directly to the built in command. However, this is an
|
|
# opportunity to also insure that SourceServer is in synch with ToolServer. So
|
|
# a variable is set to the current directory and then sent off as a command to
|
|
# SourceServer. Finally, the vanilla directory command is finished by echoing
|
|
# the current directory.
|
|
|
|
Set myDir "`Directory`"
|
|
echo "{myDir}"
|
|
RProj Directory {myDir} ≥≥Dev:Null
|
|
else
|
|
if "{1}" =~ /-q/
|
|
|
|
# Sending "Directory -q" is a special beast. I can't send the unquoted
|
|
# directory name on to SourceServer because the RProj command will treat each
|
|
# word of the file name as a seperate argument. Just send the unquoted shell
|
|
# directory back to ToolServer.
|
|
|
|
Directory "{1}"
|
|
else
|
|
|
|
# The main operation of Directory2 is to SET the directory! Do this
|
|
# for both the Shell and SourceServer.
|
|
|
|
Directory "{1}"
|
|
RProj Directory "{1}" ≥≥Dev:Null
|
|
end
|
|
end
|