Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c30d7c37
Commit
c30d7c37
authored
Jun 20, 2003
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
At startup, test that PythonLauncher is the default application for files
of type .py, .pyw and .pyc. If not, post a warning.
parent
94d09f84
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
18 deletions
+44
-18
Mac/OSX/PythonLauncher/MyAppDelegate.h
Mac/OSX/PythonLauncher/MyAppDelegate.h
+1
-0
Mac/OSX/PythonLauncher/MyAppDelegate.m
Mac/OSX/PythonLauncher/MyAppDelegate.m
+43
-0
Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj
Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj
+0
-18
No files found.
Mac/OSX/PythonLauncher/MyAppDelegate.h
View file @
c30d7c37
...
...
@@ -11,4 +11,5 @@
-
(
IBAction
)
showPreferences
:(
id
)
sender
;
-
(
BOOL
)
shouldShowUI
;
-
(
BOOL
)
shouldTerminate
;
-
(
void
)
testFileTypeBinding
;
@end
Mac/OSX/PythonLauncher/MyAppDelegate.m
View file @
c30d7c37
#import "MyAppDelegate.h"
#import "PreferencesWindowController.h"
#import <Carbon/Carbon.h>
#import <ApplicationServices/ApplicationServices.h>
@implementation
MyAppDelegate
...
...
@@ -19,6 +20,8 @@
-
(
void
)
applicationDidFinishLaunching
:(
NSNotification
*
)
notification
{
// Test that the file mappings are correct
[
self
testFileTypeBinding
];
// If we were opened because of a file drag or doubleclick
// we've set initial_action_done in shouldShowUI
// Otherwise we open a preferences dialog.
...
...
@@ -50,4 +53,44 @@
return
NO
;
}
-
(
void
)
testFileTypeBinding
{
NSURL
*
ourUrl
;
OSStatus
err
;
FSRef
appRef
;
NSURL
*
appUrl
;
static
NSString
*
extensions
[]
=
{
@"py"
,
@"pyw"
,
@"pyc"
,
NULL
};
NSString
**
ext_p
;
int
i
;
if
([[
NSUserDefaults
standardUserDefaults
]
boolForKey
:
@"SkipFileBindingTest"
])
return
;
ourUrl
=
[
NSURL
fileURLWithPath
:
[[
NSBundle
mainBundle
]
bundlePath
]];
for
(
ext_p
=
extensions
;
*
ext_p
;
ext_p
++
)
{
err
=
LSGetApplicationForInfo
(
kLSUnknownType
,
kLSUnknownCreator
,
(
CFStringRef
)
*
ext_p
,
kLSRolesViewer
,
&
appRef
,
(
CFURLRef
*
)
&
appUrl
);
if
(
err
||
!
[
appUrl
isEqual
:
ourUrl
]
)
{
i
=
NSRunAlertPanel
(
@"File type binding"
,
@"PythonLauncher is not the default application for all "
\
@"Python script types. You should fix this with the "
\
@"Finder's
\"
Get Info
\"
command.
\n\n
"
\
@"See
\"
Changing the application that opens a file
\"
in "
\
@"Mac Help for details."
,
@"OK"
,
@"Don't show this warning again"
,
NULL
);
if
(
i
==
0
)
{
// Don't show again
[[
NSUserDefaults
standardUserDefaults
]
setObject:
@"YES"
forKey
:
@"SkipFileBindingTest"
];
}
return
;
}
}
}
@end
Mac/OSX/PythonLauncher/PythonLauncher.pbproj/project.pbxproj
View file @
c30d7c37
...
...
@@ -317,24 +317,6 @@
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>????</string>
</array>
<key>CFBundleTypeIconFile</key>
<string></string>
<key>CFBundleTypeName</key>
<string>DocumentType</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>????</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>NSDocumentClass</key>
<string>MyDocument</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment