mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Allow file without filetype as long as they end in ".py".
Added a -D flag (can really only be specified on OSX commandline) to not revector sys.stderr, for debugging the IDE itself. Not sure whether this should stay.
This commit is contained in:
		
							parent
							
								
									b2e33fe285
								
							
						
					
					
						commit
						e0ba087d44
					
				
					 1 changed files with 11 additions and 1 deletions
				
			
		|  | @ -6,6 +6,7 @@ | ||||||
| import Wapplication | import Wapplication | ||||||
| import W | import W | ||||||
| import os | import os | ||||||
|  | import sys | ||||||
| import macfs | import macfs | ||||||
| import MacOS | import MacOS | ||||||
| 
 | 
 | ||||||
|  | @ -42,9 +43,16 @@ def __init__(self): | ||||||
| 				self.quitevent) | 				self.quitevent) | ||||||
| 		import PyConsole, PyEdit | 		import PyConsole, PyEdit | ||||||
| 		Splash.wait() | 		Splash.wait() | ||||||
|  | 		# With -D option (OSX command line only) keep stderr, for debugging the IDE | ||||||
|  | 		# itself. | ||||||
|  | 		debug_stderr = None | ||||||
|  | 		if sys.argv[1] == '-D': | ||||||
|  | 			debug_stderr = sys.stderr | ||||||
|  | 			del sys.argv[1] | ||||||
| 		PyConsole.installoutput() | 		PyConsole.installoutput() | ||||||
| 		PyConsole.installconsole() | 		PyConsole.installconsole() | ||||||
| 		import sys | 		if debug_stderr: | ||||||
|  | 			sys.stderr = debug_stderr | ||||||
| 		for path in sys.argv[1:]: | 		for path in sys.argv[1:]: | ||||||
| 			self.opendoc(path) | 			self.opendoc(path) | ||||||
| 		try: | 		try: | ||||||
|  | @ -171,6 +179,8 @@ def opendoc(self, path): | ||||||
| 		fcreator, ftype = macfs.FSSpec(path).GetCreatorType() | 		fcreator, ftype = macfs.FSSpec(path).GetCreatorType() | ||||||
| 		if ftype == 'TEXT': | 		if ftype == 'TEXT': | ||||||
| 			self.openscript(path) | 			self.openscript(path) | ||||||
|  | 		elif ftype == '\0\0\0\0' and path[-3:] == '.py': | ||||||
|  | 			self.openscript(path) | ||||||
| 		else: | 		else: | ||||||
| 			W.Message("Can't open file of type '%s'." % ftype) | 			W.Message("Can't open file of type '%s'." % ftype) | ||||||
| 	 | 	 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jack Jansen
						Jack Jansen