]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
If you double-click a file with creator Pyth but owner != TEXT exit with a warning...
authorJack Jansen <jack.jansen@cwi.nl>
Sun, 29 Jul 2001 21:23:18 +0000 (21:23 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sun, 29 Jul 2001 21:23:18 +0000 (21:23 +0000)
Mac/Include/pythonresources.h
Mac/Python/macmain.c
Mac/Resources/dialogs.rsrc

index 29026a88c4083f2b98a26dc5a80d1f421a6ced21..9f8b2c452a984b09a5957244c7ebcfe163385a44 100644 (file)
@@ -95,6 +95,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 /* No preferences file name resource */
 #define NOPREFNAME_ID  BASE_ID+9
 
+/* Not a script */
+#define NOTASCRIPT_ID BASE_ID+10
+
 /* EditPythonPrefs range. Needed here to forestall conflicts with applets */
 #define EDITPYTHONPREFS_MIN    508
 #define EDITPYTHONPREFS_MAX 511
index 10c5a5ff74804897e5a56232124f9ed70dd84067..b82395c9f439df54544bea7ed745cfe12ce5377b 100644 (file)
@@ -486,6 +486,11 @@ PyMac_InitApplication()
                        PyMac_FixGUSIcd();
 #endif
                }
+               /* Check that the first argument is a text file */
+               if ( PyMac_getfiletype(argv[1]) != 'TEXT' ) {
+                       Alert(NOTASCRIPT_ID, NULL);
+                       exit(0);
+               }
        }
        Py_Main(argc, argv);
 }
index 52efd23a576a169559bf7632cab5368d063bc3e2..1e219b267459e6d12be38550b2231784da26634e 100644 (file)
Binary files a/Mac/Resources/dialogs.rsrc and b/Mac/Resources/dialogs.rsrc differ