DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Untracked file

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL.  You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation.  Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation.  All Rights
# Reserved.
#

if {#} != 2
	echo "CopyList requires 2 parameters:"
	echo "Parameter 1: path relative to {SourceRootDir} of the file which contains"
	echo "             the list of files to be copied, one per line.  This path"
	echo "             may not begin with a colon"
	echo
	echo "Parameter 2: path relative to {DestRootDir} of the directory where all the"
	echo "             files are to be copied.  No initial colons!"
	echo
	Exit 1
end if

set debugEcho "" # This setting will actually duplicate the files
#set debugEcho "echo" # This setting will merely print the "duplicate" commands.

set sourceList "{SourceRootDir}{1}"
set targetDir "{DestRootDir}{2}"

# targetDir may not end in a colon for this script to work.
if `Evaluate "{targetDir}" =~ /(Ĺ)¨1:/`
	#echo "Removed a colon"
	set targetDir "{¨1}"
end if

#Ensure the target hierarchy exists
# Volume name
(Evaluate "{TargetDir}" =~ /([Â:]+)¨1:Ĺ/) ˇˇ dev:null
Set PartialPath "{¨1}"
Loop
	(Evaluate "{TargetDir}" =~ /("{PartialPath}":[Â:]+)¨1([:]*)¨2Ĺ/) ˇˇ dev:null
	Set PartialPath "{¨1}"
	Set Exit 0
	(NewFolder "{PartialPath}") ˇˇ dev:null
	Set Exit 1
	break if "{¨2}" == ""
End Loop

#Calculate the source directory by stripping off the leaf name.
(Evaluate "{SourceList}" =~ /(Ĺ:)¨1([Â:]+)¨2/) #ˇˇ dev:null
Set SourceDir "{¨1}"

if {verbose}
	echo "Source list is in file ś"{sourceList}ś""
	echo "Source directory is  ś"{SourceDir}ś""
	echo "Target directory is ś"{targetDir}ś""
end if

# Strip all comment lines, pipe the stripped lines into the "for" loop.
# We quote each whole line here so that we deal with a line at a time in the
# for loop. Don't ya just love MPW quoting rulesÉ

for f in `streamedit "{sourceList}" -e '/Ľ#Ĺ/ Delete; /Ľ/ Replace /(Ĺ)¨1/ "ś""¨1"ś""'`
	
	if `evaluate "{{f}}" != ""`
	
		# strip out trailing comments (in fact, anything following whitespace)
		if `evaluate "{f}" =~ /([Â śt]+)¨1[ śt]+([#]*Ĺ)¨2/`
			set sourceFile "{¨1}"
			# echo "Discarding comment {¨2}"
		else
			set sourceFile "{f}"
		end if
		
		# sourceFile can be a relative path, so need to get the file name for date comparisons
		if `evaluate "{sourceFile}" =~ /Ĺ:([Â:]+)¨1/`
			set filename "{¨1}"
		else
			set filename "{sourceFile}"
		end if
		
		# now copy the file if newer
		if "`Newer "{sourceDir}{sourceFile}" "{targetDir}:{filename}"`" 		#|| !`Exists "{targetDir}:{filename}"`
			if {verbose} ; echo "{sourceDir}{sourceFile} is newer than {targetDir}:{filename}" ; end if
			#{debugEcho} duplicate -y "{sourceDir}{sourceFile}" "{targetDir}"
			{debugEcho} newalias "{sourceDir}{sourceFile}" "{targetDir}:{filename}"
		end if
		
	end if
	
end for