From: Jack Jansen Date: Sun, 29 Jul 2001 21:23:18 +0000 (+0000) Subject: If you double-click a file with creator Pyth but owner != TEXT exit with a warning... X-Git-Tag: v2.1.2c1~120 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=75975c70ab13cc3e763da36b90006cb86112643d;p=thirdparty%2FPython%2Fcpython.git If you double-click a file with creator Pyth but owner != TEXT exit with a warning that this is not a script but an auxiliary document such as a preferrences file or an aplication template. This is a lot better than giving syntax errors on binary data:-) --- diff --git a/Mac/Include/pythonresources.h b/Mac/Include/pythonresources.h index 29026a88c408..9f8b2c452a98 100644 --- a/Mac/Include/pythonresources.h +++ b/Mac/Include/pythonresources.h @@ -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 diff --git a/Mac/Python/macmain.c b/Mac/Python/macmain.c index 10c5a5ff7480..b82395c9f439 100644 --- a/Mac/Python/macmain.c +++ b/Mac/Python/macmain.c @@ -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); } diff --git a/Mac/Resources/dialogs.rsrc b/Mac/Resources/dialogs.rsrc index 52efd23a576a..1e219b267459 100644 Binary files a/Mac/Resources/dialogs.rsrc and b/Mac/Resources/dialogs.rsrc differ