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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
|
property pBuildFolderName : "Sequin Folder"
property pFolders2Copy : {"data", "errmsg", "doc:images"}
property pFolders2Pack : {"data", "errmsg", "images"}
property pApps2Pack : {"Entrez2", "Sequin"}
with timeout of 600 seconds
SetGlobals()
tell application "Finder"
-- First. Some sanity checks.
repeat with f in pFolders2Copy
if not (exists folder (gDistribRoot & f)) then
error "Folder " & (gDistribRoot & f) & return & " does not exist."
end if
end repeat
repeat with f in pApps2Pack
if not (exists file (gProjectsDir & f & "OS9")) then
error "Carbon Application " & (gProjectsDir & f & "OS9") & return & " does not exist."
end if
if not (exists file (gProjectsDir & f & "OSX.app")) then
error "Mach-O Application " & (gProjectsDir & f & "OSX.app") & return & " does not exist."
end if
end repeat
if not (exists file (gDistribRoot & "doc:sequin.htm")) then
error "File " & (gDistribRoot & "doc:sequin.htm") & return & " does not exist."
end if
-- copy the auxiliary folders to the build folder and clean them up.
repeat with f in pFolders2Copy
duplicate folder (gDistribRoot & f) to gProjectsDir with replacing
end repeat
repeat with f in pFolders2Pack
set cvsFolderName to (gProjectsDir & f & ":CVS")
if exists folder cvsFolderName then
--try
tell application "Finder" to delete folder cvsFolderName
--end try
end if
end repeat
-- install auxiliary folders in applications
repeat with ap in pApps2Pack
duplicate folder (gProjectsDir & "data") to
folder (gProjectsDir & ap & "OSX.app:Contents:Resources") with replacing
end repeat
duplicate folder (gProjectsDir & "errmsg") to
folder (gProjectsDir & "SequinOSX.app:Contents:Resources") with replacing
-- make a clean archive folder.
if exists folder pBuildFolderName of gDesktop then
delete folder pBuildFolderName of gDesktop
end if
make new folder at gDesktop with properties {name:pBuildFolderName}
set gArchiveFolder to folder pBuildFolderName of gDesktop
-- copy the applications & folders to the archive.
repeat with f in pFolders2Pack
duplicate folder (gProjectsDir & f) to gArchiveFolder
end repeat
duplicate file (gDistribRoot & "doc:sequin.htm") to gArchiveFolder
repeat with ap in pApps2Pack
move file (gProjectsDir & ap & "OS9") to gArchiveFolder
move file (gProjectsDir & ap & "OSX.app") to gArchiveFolder
end repeat
end tell
end timeout
-- NOTE: gDesktop is an alias, not a string path name like the rest.
global gDesktop
global gStartupDisk
global gHomeDir
global gMWroot
global gDistribRoot
global gProjectsDir
global gArchiveFolder
global gMakeDir
on SetGlobals()
set gDesktop to path to desktop
tell application "Finder"
set gStartupDisk to startup disk as string
set gHomeDir to my HomeDir()
set gMWroot to my MWRootDir()
set gDistribRoot to my ModuleRoot()
set gProjectsDir to gDistribRoot & "build:"
set gMakeDir to my GetMyPath()
end tell
end SetGlobals
on ModuleRoot()
set subFolder to "ncbi"
set modRoot to ""
try
set modRoot to ResolveAlias(gMWroot & subFolder)
on error
try
set modRoot to ResolveAlias(gHomeDir & subFolder)
end try
end try
return modRoot
end ModuleRoot
on GetMyPath()
set myPath to path to me as string
if myPath contains "Script Editor" then
-- Oops! running under script editor. 'me' is Script Editor not this script.
-- use the location this script is supposed to be in.
return gDistribRoot & "make:"
else
tell application "Finder"
return container of myPath
end tell
end if
end GetMyPath
on MWRootDir()
set mwRoot to ""
set mwLocations to {gStartupDisk, gStartupDisk & "Applications:", gStartupDisk & "AppsLocal:",
gStartupDisk & "Applications (Mac OS 9):", gHomeDir, gHomeDir & "Applications:",
gHomeDir & "Applications:", gHomeDir & "AppsLocal (Mac OS 9):"}
repeat with mwVersion from 8 to 9
repeat with mwSubVersion from 0 to 6
set dirName to "Metrowerks CodeWarrior " & mwVersion & "." & mwSubVersion
repeat with mwLoc in mwLocations
try
set mwRoot to ResolveAlias(mwLoc & dirName)
return mwRoot
end try
end repeat
end repeat
end repeat
error "Can't find the Metrowerks CodeWarrior folder."
end MWRootDir
on HomeDir()
tell application "Finder"
if my IsOSX() then
return the home as string
else
return gStartupDisk
end if
end tell
end HomeDir
on ResolveAlias(pathname)
tell application "Finder"
--if the last character of pathname is ":" then error "Don't use a trailing colon with ResolveAlias."
if exists folder pathname then return pathname & ":"
if exists alias file pathname then return the original item of alias file pathname as string
error "The folder (or alias) '" & pathname & "' doesn't exist."
end tell
end ResolveAlias
on IsOSX()
tell application "Finder"
set vers to the version as text
if second character of vers is equal to "." then
set vers to "0" & vers
end if
return vers > 10 or vers = 10
end tell
end IsOSX
|