mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 18:27:35 +00:00
98 lines
3.2 KiB
Plaintext
98 lines
3.2 KiB
Plaintext
#
|
|
# 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
|