changeset 67785:9574f135f272

[MAC_OS] (find_image_fsspec): Use coercion of Apple event data for translation from/to file names.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Sat, 24 Dec 2005 02:50:00 +0000
parents 7c9d6a4a35c7
children 55dd97aa46da
files src/image.c
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Sat Dec 24 01:35:53 2005 +0000
+++ b/src/image.c	Sat Dec 24 02:50:00 2005 +0000
@@ -2259,23 +2259,25 @@
      Lisp_Object specified_file, *file;
      FSSpec *fss;
 {
-#if MAC_OSX
-  FSRef fsr;
-#endif
   OSErr err;
+  AEDesc desc;
 
   *file = x_find_image_file (specified_file);
   if (!STRINGP (*file))
     return fnfErr;		/* file or directory not found;
 				   incomplete pathname */
   /* Try to open the image file.  */
-#if MAC_OSX
-  err = FSPathMakeRef (SDATA (*file), &fsr, NULL);
+  err = AECoercePtr (TYPE_FILE_NAME, SDATA (*file),
+		     SBYTES (*file), typeFSS, &desc);
   if (err == noErr)
-    err = FSGetCatalogInfo (&fsr, kFSCatInfoNone, NULL, NULL, fss, NULL);
+    {
+#if TARGET_API_MAC_CARBON
+      err = AEGetDescData (&desc, fss, sizeof (FSSpec));
 #else
-  err = posix_pathname_to_fsspec (SDATA (*file), fss);
+      *fss = *(FSSpec *)(*(desc.dataHandle));
 #endif
+      AEDisposeDesc (&desc);
+    }
   return err;
 }