diff options
| author | YAMAMOTO Mitsuharu | 2005-12-24 02:50:00 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2005-12-24 02:50:00 +0000 |
| commit | 2d22e7edf2d46b0907d88dc8332b21fd3430c6e3 (patch) | |
| tree | 91bac9f21640451181d90322ceadf6384b995fc8 /src | |
| parent | 70128967dace2bdf6d9c4c713461ba7221942058 (diff) | |
| download | emacs-2d22e7edf2d46b0907d88dc8332b21fd3430c6e3.tar.gz emacs-2d22e7edf2d46b0907d88dc8332b21fd3430c6e3.zip | |
[MAC_OS] (find_image_fsspec): Use coercion of Apple event data for
translation from/to file names.
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/image.c b/src/image.c index 8a6d40ae34f..579c04e6f46 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -2259,23 +2259,25 @@ find_image_fsspec (specified_file, file, fss) | |||
| 2259 | Lisp_Object specified_file, *file; | 2259 | Lisp_Object specified_file, *file; |
| 2260 | FSSpec *fss; | 2260 | FSSpec *fss; |
| 2261 | { | 2261 | { |
| 2262 | #if MAC_OSX | ||
| 2263 | FSRef fsr; | ||
| 2264 | #endif | ||
| 2265 | OSErr err; | 2262 | OSErr err; |
| 2263 | AEDesc desc; | ||
| 2266 | 2264 | ||
| 2267 | *file = x_find_image_file (specified_file); | 2265 | *file = x_find_image_file (specified_file); |
| 2268 | if (!STRINGP (*file)) | 2266 | if (!STRINGP (*file)) |
| 2269 | return fnfErr; /* file or directory not found; | 2267 | return fnfErr; /* file or directory not found; |
| 2270 | incomplete pathname */ | 2268 | incomplete pathname */ |
| 2271 | /* Try to open the image file. */ | 2269 | /* Try to open the image file. */ |
| 2272 | #if MAC_OSX | 2270 | err = AECoercePtr (TYPE_FILE_NAME, SDATA (*file), |
| 2273 | err = FSPathMakeRef (SDATA (*file), &fsr, NULL); | 2271 | SBYTES (*file), typeFSS, &desc); |
| 2274 | if (err == noErr) | 2272 | if (err == noErr) |
| 2275 | err = FSGetCatalogInfo (&fsr, kFSCatInfoNone, NULL, NULL, fss, NULL); | 2273 | { |
| 2274 | #if TARGET_API_MAC_CARBON | ||
| 2275 | err = AEGetDescData (&desc, fss, sizeof (FSSpec)); | ||
| 2276 | #else | 2276 | #else |
| 2277 | err = posix_pathname_to_fsspec (SDATA (*file), fss); | 2277 | *fss = *(FSSpec *)(*(desc.dataHandle)); |
| 2278 | #endif | 2278 | #endif |
| 2279 | AEDisposeDesc (&desc); | ||
| 2280 | } | ||
| 2279 | return err; | 2281 | return err; |
| 2280 | } | 2282 | } |
| 2281 | 2283 | ||