summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/macfsmodule.c
diff options
context:
space:
mode:
authorJust van Rossum <just@letterror.com>2001-10-31 22:55:08 (GMT)
committerJust van Rossum <just@letterror.com>2001-10-31 22:55:08 (GMT)
commitab57c7dcfc684d6f10468f6dc88dfa1b24ea967f (patch)
treea22adc49c94d3be7e4946a5d5a44e0b21c54c480 /Mac/Modules/macfsmodule.c
parente2ec3ebcb852923a7ce23122dcd32c341c9416b9 (diff)
downloadcpython-ab57c7dcfc684d6f10468f6dc88dfa1b24ea967f.zip
cpython-ab57c7dcfc684d6f10468f6dc88dfa1b24ea967f.tar.gz
cpython-ab57c7dcfc684d6f10468f6dc88dfa1b24ea967f.tar.bz2
Moved macfsn hackery from macmain.c to macfsmodule.c so it loads
on demand instead of at startup.
Diffstat (limited to 'Mac/Modules/macfsmodule.c')
-rw-r--r--Mac/Modules/macfsmodule.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/Mac/Modules/macfsmodule.c b/Mac/Modules/macfsmodule.c
index 15d9f30..f16cd36 100644
--- a/Mac/Modules/macfsmodule.c
+++ b/Mac/Modules/macfsmodule.c
@@ -39,6 +39,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "getapplbycreator.h"
+#include "pythonresources.h"
+extern PyMac_PrefRecord PyMac_options;
+
#ifdef USE_TOOLBOX_OBJECT_GLUE
extern int _PyMac_GetFSSpec(PyObject *, FSSpec *);
extern PyObject *_PyMac_BuildFSSpec(FSSpec *);
@@ -1206,6 +1209,33 @@ PyObject *PyMac_BuildFSSpec(FSSpec *v)
return (PyObject *)newmfssobject(v);
}
+
+/*
+** Import the macfsn module, which will override the Standard File
+** calls in the macfs builtin module by Navigation Services versions,
+** if available on this machine.
+*/
+static void
+PyMac_InstallNavServicesForSF(void)
+{
+ if ( !PyMac_options.nonavservice ) {
+ PyObject *m = PyImport_ImportModule("macfsn");
+
+ if ( m == NULL ) {
+ PySys_WriteStderr("'import macfsn' failed; ");
+ if (Py_VerboseFlag) {
+ PySys_WriteStderr("traceback:\n");
+ PyErr_Print();
+ }
+ else {
+ PySys_WriteStderr("use -v for traceback\n");
+ }
+ PyErr_Clear();
+ }
+ }
+}
+
+
/* Initialization function for the module (*must* be called initmacfs) */
void
@@ -1235,5 +1265,6 @@ initmacfs(void)
Mfsitype.ob_type = &PyType_Type;
Py_INCREF(&Mfsitype);
PyDict_SetItemString(d, "FInfoType", (PyObject *)&Mfsitype);
- /* XXXX Add constants here */
+
+ PyMac_InstallNavServicesForSF();
}