]> cygwin.com Git - cygwin-apps/setup.git/commitdiff
* ini.h: Use is_legacy to control setup.ini names.
authorChristopher Faylor <me@cgf.cx>
Tue, 22 Dec 2009 17:12:46 +0000 (17:12 +0000)
committerChristopher Faylor <me@cgf.cx>
Tue, 22 Dec 2009 17:12:46 +0000 (17:12 +0000)
* main.cc (set_legacy): New function.
(main): Call set_legacy with program name to determine if this is supposed to
be an installation of the legacy version of cygwin.  Issue a warning on attempt
to install legacy on Windows NT class system.

ChangeLog
ini.h
main.cc

index 915e923a305cbf455f0ba2ba74d41fe0948fc5ef..dfa162dbcef693afe3adc86e1485207938c51e48 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-12-22  Christopher Faylor  <me+cygwin@cgf.cx>
+
+       * ini.h: Use is_legacy to control setup.ini names.
+       * main.cc (set_legacy): New function.
+       (main): Call set_legacy with program name to determine if this is
+       supposed to be an installation of the legacy version of cygwin.  Issue
+       a warning on attempt to install legacy on Windows NT class system.
+
 2009-12-22  Christopher Faylor  <me+cygwin@cgf.cx>
 
        * package_message (packagemessage::display): Avoid displaying a message
diff --git a/ini.h b/ini.h
index d7864a8bbdc69c87491240a5ab3a4b7c1779b659..7276e0a755db3f590ef40cfa142a6dac0f153631 100644 (file)
--- a/ini.h
+++ b/ini.h
@@ -36,11 +36,11 @@ typedef enum
   EXCLUDE_NONE = 0,
   EXCLUDE_BY_SETUP,
   EXCLUDE_NOT_FOUND
-}
-excludes;
+} excludes;
 
-#define SETUP_INI_FILENAME (IsWindowsNT () ? "setup-2.ini" : "setup.ini")
-#define SETUP_BZ2_FILENAME (IsWindowsNT () ? "setup-2.bz2" : "setup.bz2")
+extern bool is_legacy;
+#define SETUP_INI_FILENAME (is_legacy ? "setup-legacy.ini" : "setup.ini")
+#define SETUP_BZ2_FILENAME (is_legacy ? "setup-legacy.bz2" : "setup.bz2")
 
 /* The following three vars are used to facilitate error handling between the
    parser/lexer and its callers, namely ini.cc:do_remote_ini() and
diff --git a/main.cc b/main.cc
index b6b56335948e3670a9781793a44cebf75fafd806..2f028750f72cd5d7c1ad84830344cec269437c97 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -82,6 +82,7 @@ static const char *cvsid =
 using namespace std;
 
 HINSTANCE hinstance;
+bool is_legacy;
 
 static BoolOption UnattendedOption (false, 'q', "quiet-mode", "Unattended setup mode");
 static BoolOption HelpOption (false, 'h', "help", "print help");
@@ -211,6 +212,15 @@ main_display ()
   CoUninitialize ();
 }
 
+static void
+set_legacy (const char *command)
+{
+  char buf[MAX_PATH];
+  GetLongPathName (command, buf, MAX_PATH);
+  strlwr (buf);
+  is_legacy = strstr (buf, "setup-legacy");
+}
+
 #ifndef __CYGWIN__
 int WINAPI
 WinMain (HINSTANCE h,
@@ -230,14 +240,28 @@ main (int argc, char **argv)
   snprintf(locale, sizeof locale, ".%u", GetACP());
   setlocale(LC_ALL, locale);
 
-  if (!IsWindowsNT ())
+  set_legacy (_argv[0]);
+
+  if (is_legacy && IsWindowsNT ())
+    {
+      if (MessageBox (NULL,
+                     "You are attempting to install a legacy version of Cygwin\n"
+                     "on a modern version of Windows.  Press \"OK\" if this is\n"
+                     "really want you want to do.  Otherwise press \"Cancel\".\n"
+                     "See http://cygwin.com/ for more information.",
+                     "Attempt to install legacy version of Cygwin",
+                     MB_OKCANCEL | MB_ICONSTOP | MB_SETFOREGROUND | MB_TOPMOST)
+         == IDCANCEL)
+       return 1;
+    }
+  else if (!is_legacy && !IsWindowsNT ())
     {
       MessageBox (NULL,
                  "Cygwin 1.7 and later does not run on Windows 95,\n"
                  "Windows 98, or Windows Me.  If you want to install Cygwin\n"
                  "on one of these systems, please install an older version.\n"
                  "See http://cygwin.com/ for more information.",
-                 "Unsupported Version of Windows detected",
+                 "Unsupported version of Windows detected",
                  MB_OK | MB_ICONSTOP | MB_SETFOREGROUND | MB_TOPMOST);
       return 1;
     }
This page took 0.043248 seconds and 5 git commands to generate.