A collection of hacks for broken installations, like Neverwinter Nights.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 30 May 2004 15:23:29 +0000
changeset 44 8ddfda0b6aaa
parent 43 d11e3fdb54b2
child 45 273952a3dc2a
A collection of hacks for broken installations, like Neverwinter Nights.
platform_unix.c
--- a/platform_unix.c	Sun May 30 04:05:10 2004 +0000
+++ b/platform_unix.c	Sun May 30 15:23:29 2004 +0000
@@ -282,6 +282,10 @@
         {
             if (strcasecmp(val,"CFBundleIdentifier") == 0)
                 have_key = 1;
+            #if 1  /* lame hack for NWN Expansion pack patch */
+            else if (strcasecmp(val,"CFBundleIconFile") == 0)
+                have_key = 1;
+            #endif
         } /* if */
     } /* while */
     
@@ -453,7 +457,33 @@
         return(0);
     } /* if */
 
-    return(hasident ? parse_info_dot_plist(str, version, newversion) : 1);
+    if (hasident)
+        return(parse_info_dot_plist(str, version, newversion));
+
+#if 1
+    /*
+     * !!! FIXME: This is a hack. If no identifier is specified, use
+     *  "version"  as a filename that signifies you're in the right place.
+     * This is for patching things without app bundles or badly-written
+     * app bundles. This needs a better solution.
+     */
+    if ((version == NULL) || (*version))  /* Take everything on blind faith. */
+        return(1);
+
+    if (!file_exists(version))
+    {
+        int yes = ui_prompt_ny("We don't think we're looking at the right directory!"
+                               " Are you SURE this is the right place?"
+                               " If you aren't sure, clicking 'Yes' can destroy unrelated files!");
+        if (!yes)
+        {
+            _fatal("Stopping at user's request.");
+            return(0);
+        } /* if */
+    } /* if */
+#endif
+
+    return(1);
 } /* chdir_by_identifier */