|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/make/packApps.met |
source navigation diff markup identifier search freetext search file search |
1 property pBuildFolderName : "Sequin Folder"
2 property pFolders2Copy : {"data", "errmsg", "doc:images"}
3 property pFolders2Pack : {"data", "errmsg", "images"}
4 property pApps2Pack : {"Entrez2", "Sequin"}
5
6
7 with timeout of 600 seconds
8 SetGlobals()
9
10 tell application "Finder"
11
12 -- First. Some sanity checks.
13 repeat with f in pFolders2Copy
14 if not (exists folder (gDistribRoot & f)) then
15 error "Folder " & (gDistribRoot & f) & return & " does not exist."
16 end if
17 end repeat
18 repeat with f in pApps2Pack
19 if not (exists file (gProjectsDir & f & "OS9")) then
20 error "Carbon Application " & (gProjectsDir & f & "OS9") & return & " does not exist."
21 end if
22 if not (exists file (gProjectsDir & f & "OSX.app")) then
23 error "Mach-O Application " & (gProjectsDir & f & "OSX.app") & return & " does not exist."
24 end if
25 end repeat
26 if not (exists file (gDistribRoot & "doc:sequin.htm")) then
27 error "File " & (gDistribRoot & "doc:sequin.htm") & return & " does not exist."
28 end if
29
30 -- copy the auxiliary folders to the build folder and clean them up.
31 repeat with f in pFolders2Copy
32 duplicate folder (gDistribRoot & f) to gProjectsDir with replacing
33 end repeat
34
35 repeat with f in pFolders2Pack
36 set cvsFolderName to (gProjectsDir & f & ":CVS")
37 if exists folder cvsFolderName then
38 --try
39 tell application "Finder" to delete folder cvsFolderName
40 --end try
41 end if
42 end repeat
43
44 -- install auxiliary folders in applications
45 repeat with ap in pApps2Pack
46 duplicate folder (gProjectsDir & "data") to Â
47 folder (gProjectsDir & ap & "OSX.app:Contents:Resources") with replacing
48 end repeat
49 duplicate folder (gProjectsDir & "errmsg") to Â
50 folder (gProjectsDir & "SequinOSX.app:Contents:Resources") with replacing
51
52 -- make a clean archive folder.
53 if exists folder pBuildFolderName of gDesktop then
54 delete folder pBuildFolderName of gDesktop
55 end if
56 make new folder at gDesktop with properties {name:pBuildFolderName}
57 set gArchiveFolder to folder pBuildFolderName of gDesktop
58
59 -- copy the applications & folders to the archive.
60 repeat with f in pFolders2Pack
61 duplicate folder (gProjectsDir & f) to gArchiveFolder
62 end repeat
63 duplicate file (gDistribRoot & "doc:sequin.htm") to gArchiveFolder
64
65 repeat with ap in pApps2Pack
66 move file (gProjectsDir & ap & "OS9") to gArchiveFolder
67 move file (gProjectsDir & ap & "OSX.app") to gArchiveFolder
68 end repeat
69
70 end tell
71 end timeout
72
73 -- NOTE: gDesktop is an alias, not a string path name like the rest.
74 global gDesktop
75 global gStartupDisk
76 global gHomeDir
77 global gMWroot
78 global gDistribRoot
79 global gProjectsDir
80 global gArchiveFolder
81
82 global gMakeDir
83
84 on SetGlobals()
85 set gDesktop to path to desktop
86 tell application "Finder"
87
88 set gStartupDisk to startup disk as string
89 set gHomeDir to my HomeDir()
90 set gMWroot to my MWRootDir()
91 set gDistribRoot to my ModuleRoot()
92 set gProjectsDir to gDistribRoot & "build:"
93
94 set gMakeDir to my GetMyPath()
95
96 end tell
97 end SetGlobals
98
99 on ModuleRoot()
100
101 set subFolder to "ncbi"
102
103 set modRoot to ""
104 try
105 set modRoot to ResolveAlias(gMWroot & subFolder)
106 on error
107 try
108 set modRoot to ResolveAlias(gHomeDir & subFolder)
109 end try
110 end try
111
112 return modRoot
113 end ModuleRoot
114
115 on GetMyPath()
116 set myPath to path to me as string
117 if myPath contains "Script Editor" then
118 -- Oops! running under script editor. 'me' is Script Editor not this script.
119 -- use the location this script is supposed to be in.
120 return gDistribRoot & "make:"
121 else
122 tell application "Finder"
123 return container of myPath
124 end tell
125 end if
126 end GetMyPath
127
128 on MWRootDir()
129
130 set mwRoot to ""
131 set mwLocations to {gStartupDisk, gStartupDisk & "Applications:", gStartupDisk & "AppsLocal:", Â
132 gStartupDisk & "Applications (Mac OS 9):", gHomeDir, gHomeDir & "Applications:", Â
133 gHomeDir & "Applications:", gHomeDir & "AppsLocal (Mac OS 9):"}
134 repeat with mwVersion from 8 to 9
135 repeat with mwSubVersion from 0 to 6
136 set dirName to "Metrowerks CodeWarrior " & mwVersion & "." & mwSubVersion
137 repeat with mwLoc in mwLocations
138 try
139 set mwRoot to ResolveAlias(mwLoc & dirName)
140 return mwRoot
141 end try
142 end repeat
143 end repeat
144 end repeat
145
146 error "Can't find the Metrowerks CodeWarrior folder."
147
148 end MWRootDir
149
150 on HomeDir()
151 tell application "Finder"
152
153 if my IsOSX() then
154 return the home as string
155 else
156 return gStartupDisk
157 end if
158
159 end tell
160 end HomeDir
161
162 on ResolveAlias(pathname)
163 tell application "Finder"
164 --if the last character of pathname is ":" then error "Don't use a trailing colon with ResolveAlias."
165 if exists folder pathname then return pathname & ":"
166 if exists alias file pathname then return the original item of alias file pathname as string
167 error "The folder (or alias) '" & pathname & "' doesn't exist."
168 end tell
169 end ResolveAlias
170
171 on IsOSX()
172 tell application "Finder"
173
174 set vers to the version as text
175
176 if second character of vers is equal to "." then
177 set vers to "0" & vers
178 end if
179
180 return vers > 10 or vers = 10
181
182 end tell
183 end IsOSX
|
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |