Mercurial > cpython-lru_cache-weakref
annotate Mac/Python/getapplbycreator.c @ 5817:48b94de85bf3 legacy-trunk
Extensive changes by AMK.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 17 Jul 1997 16:29:42 +0000 |
| parents | d6b292a33cfe |
| children | ccb6d76633be |
| rev | line source |
|---|---|
|
5079
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
1 /*********************************************************** |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
2 Copyright 1991-1997 by Stichting Mathematisch Centrum, Amsterdam, |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
3 The Netherlands. |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
4 |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
5 All Rights Reserved |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
6 |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
7 Permission to use, copy, modify, and distribute this software and its |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
8 documentation for any purpose and without fee is hereby granted, |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
9 provided that the above copyright notice appear in all copies and that |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
10 both that copyright notice and this permission notice appear in |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
11 supporting documentation, and that the names of Stichting Mathematisch |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
12 Centrum or CWI or Corporation for National Research Initiatives or |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
13 CNRI not be used in advertising or publicity pertaining to |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
14 distribution of the software without specific, written prior |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
15 permission. |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
16 |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
17 While CWI is the initial source for this software, a modified version |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
18 is made available by the Corporation for National Research Initiatives |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
19 (CNRI) at the Internet address ftp://ftp.python.org. |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
20 |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
21 STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
22 REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
23 MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
24 CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
25 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
26 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
27 TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
28 PERFORMANCE OF THIS SOFTWARE. |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
29 |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
30 ******************************************************************/ |
|
d6b292a33cfe
Added/updated copyright notices
Jack Jansen <jack.jansen@cwi.nl>
parents:
4319
diff
changeset
|
31 |
|
4319
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
32 /* |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
33 ** FindApplicationFromCreator uses the Desktop Database to |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
34 ** locate the creator application for the given document |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
35 ** |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
36 ** this routine will check the desktop database of all local |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
37 ** disks, then the desktop databases of all server volumes |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
38 ** (so up to two passes will be made) |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
39 ** |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
40 ** This code was created from FindApplicationFromDocument |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
41 ** routine, origin unknown. |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
42 */ |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
43 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
44 #include <Types.h> |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
45 #include <Files.h> |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
46 #include <Errors.h> |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
47 #include "getapplbycreator.h" |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
48 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
49 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
50 OSErr FindApplicationFromCreator(OSType creator, |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
51 FSSpecPtr applicationFSSpecPtr) |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
52 { |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
53 enum { localPass, remotePass, donePass } volumePass; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
54 DTPBRec desktopParams; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
55 HParamBlockRec hfsParams; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
56 short volumeIndex; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
57 Boolean foundFlag; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
58 GetVolParmsInfoBuffer volumeInfoBuffer; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
59 OSErr retCode; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
60 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
61 /* dkj 12/94 initialize flag to false (thanks to Peter Baral for pointing out this bug) */ |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
62 foundFlag = false; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
63 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
64 volumePass = localPass; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
65 volumeIndex = 0; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
66 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
67 do { |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
68 /* |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
69 ** first, find the vRefNum of the volume whose Desktop Database |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
70 ** we're checking this time |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
71 */ |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
72 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
73 volumeIndex++; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
74 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
75 /* convert the volumeIndex into a vRefNum */ |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
76 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
77 hfsParams.volumeParam.ioNamePtr = nil; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
78 hfsParams.volumeParam.ioVRefNum = 0; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
79 hfsParams.volumeParam.ioVolIndex = volumeIndex; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
80 retCode = PBHGetVInfoSync(&hfsParams); |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
81 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
82 /* a nsvErr indicates that the current pass is over */ |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
83 if (retCode == nsvErr) goto SkipThisVolume; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
84 if (retCode != noErr) goto Bail; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
85 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
86 /* |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
87 ** call GetVolParms to determine if this volume is a server |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
88 ** (a remote volume) |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
89 */ |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
90 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
91 hfsParams.ioParam.ioBuffer = (Ptr) &volumeInfoBuffer; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
92 hfsParams.ioParam.ioReqCount = sizeof(GetVolParmsInfoBuffer); |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
93 retCode = PBHGetVolParmsSync(&hfsParams); |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
94 if (retCode != noErr) goto Bail; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
95 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
96 /* |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
97 ** if the vMServerAdr field of the volume information buffer |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
98 ** is zero, this is a local volume; skip this volume |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
99 ** if it's local on a remote pass or remote on a local pass |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
100 */ |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
101 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
102 if ((volumeInfoBuffer.vMServerAdr != 0) != |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
103 (volumePass == remotePass)) goto SkipThisVolume; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
104 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
105 /* okay, now we've found the vRefNum for our desktop database call */ |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
106 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
107 desktopParams.ioVRefNum = hfsParams.volumeParam.ioVRefNum; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
108 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
109 /* |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
110 ** find the path refNum for the desktop database for |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
111 ** the volume we're interested in |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
112 */ |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
113 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
114 desktopParams.ioNamePtr = nil; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
115 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
116 retCode = PBDTGetPath(&desktopParams); |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
117 if (retCode == noErr && desktopParams.ioDTRefNum != 0) { |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
118 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
119 /* |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
120 ** use the GetAPPL call to find the preferred application |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
121 ** for opening any document with this one's creator |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
122 */ |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
123 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
124 desktopParams.ioIndex = 0; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
125 desktopParams.ioFileCreator = creator; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
126 desktopParams.ioNamePtr = applicationFSSpecPtr->name; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
127 retCode = PBDTGetAPPLSync(&desktopParams); |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
128 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
129 if (retCode == noErr) { |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
130 /* |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
131 ** okay, found it; fill in the application file spec |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
132 ** and set the flag indicating we're done |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
133 */ |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
134 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
135 applicationFSSpecPtr->parID = desktopParams.ioAPPLParID; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
136 applicationFSSpecPtr->vRefNum = desktopParams.ioVRefNum; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
137 foundFlag = true; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
138 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
139 } |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
140 } |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
141 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
142 SkipThisVolume: |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
143 /* |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
144 ** if retCode indicates a no such volume error or if this |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
145 ** was the first pass, it's time to move on to the next pass |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
146 */ |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
147 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
148 if (retCode == nsvErr) { |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
149 volumePass++; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
150 volumeIndex = 0; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
151 } |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
152 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
153 } while (foundFlag == false && volumePass != donePass); |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
154 |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
155 Bail: |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
156 if (retCode == nsvErr) |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
157 return fnfErr; /* More logical than "No such volume" */ |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
158 return retCode; |
|
97133996e22f
Added macfs.FindApplication() to find application FSSpec given signature.
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff
changeset
|
159 } |
