platform_unix.c
changeset 9 4a96fabb7b79
parent 8 013c7889f09e
child 19 f556da1872f4
--- a/platform_unix.c	Tue May 25 12:22:09 2004 +0000
+++ b/platform_unix.c	Tue May 25 12:28:34 2004 +0000
@@ -237,7 +237,44 @@
 } /* find_info_plist_version */
 
 
-static int parse_info_dot_plist(const char *version)
+/* !!! FIXME: Code duplication */
+static char *find_info_plist_bundle_id(char *ptr)
+{
+    int have_key = 0;
+    char *tag;
+    char *val;
+
+    while ( (ptr = parse_xml(ptr, &tag, &val)) != NULL )
+    {
+        if (have_key)
+        {
+            have_key = 0;
+            if (strcasecmp(tag, "string") == 0)
+                return(val);
+        } /* if */
+
+        if ((strcasecmp(tag, "plist") == 0) || (strcasecmp(tag, "dict") == 0))
+        {
+            ptr = val;
+            continue;
+        } /* if */
+
+        /* You should only use CFBundleShortVersionString, for various
+         *  reasons not worth explaining here. CFBundleVersion is here
+         *  for older products that need to update to the other tag.
+         */
+        if (strcasecmp(tag,"key") == 0)
+        {
+            if (strcasecmp(val,"CFBundleIdentifier") == 0)
+                have_key = 1;
+        } /* if */
+    } /* while */
+    
+    return(NULL);
+} /* find_info_plist_version */
+
+
+static int parse_info_dot_plist(const char *ident, const char *version)
 {
     const char *fname = "Contents/Info.plist";  // already chdir'd for this.
     char *mem = NULL;