Index: src/pgAdmin3.cpp =================================================================== RCS file: /projects/pgadmin3/src/pgAdmin3.cpp,v retrieving revision 1.111 diff -u -r1.111 pgAdmin3.cpp --- src/pgAdmin3.cpp 2 Mar 2005 23:47:23 -0000 1.111 +++ src/pgAdmin3.cpp 12 Mar 2005 16:21:00 -0000 @@ -20,6 +20,7 @@ #include #include #include +#include // Windows headers #ifdef __WXMSW__ @@ -87,6 +88,8 @@ #define DOC_DIR wxT("/docs") #define UI_DIR wxT("/ui") #define COMMON_DIR wxT("/common") +#define SCRIPT_DIR wxT("/scripts") +#define HELPER_DIR wxT("/helper") #define LANG_FILE wxT("pgadmin3.lng") @@ -171,7 +174,7 @@ // evaluate all working paths -#ifdef __WXMSW__ +#if defined(__WXMSW__) backupExecutable = path.FindValidPath(wxT("pg_dump.exe")); restoreExecutable = path.FindValidPath(wxT("pg_restore.exe")); @@ -186,6 +189,33 @@ else docPath = loadPath + wxT("/../..") DOC_DIR; +#elif defined(__WXMAC__) + + //When using wxStandardPaths on OSX, wx defaults to the unix, + //not to the mac variants. Therefor, we request wxStandardPathsCF + //directly. + wxStandardPathsCF stdPaths ; + wxString dataDir = stdPaths.GetDataDir() ; + if (dataDir) { + wxFprintf(stderr, wxT("DataDir: ") + dataDir + wxT("\n")) ; + if (wxDir::Exists(dataDir + HELPER_DIR)) + path.Add(dataDir + HELPER_DIR) ; + if (wxDir::Exists(dataDir + SCRIPT_DIR)) + path.Add(dataDir + SCRIPT_DIR) ; + if (wxDir::Exists(dataDir + UI_DIR)) + uiPath = dataDir + UI_DIR ; + if (wxDir::Exists(dataDir + DOC_DIR)) + docPath = dataDir + DOC_DIR ; + } + + if (uiPath.IsEmpty()) + uiPath = loadPath + UI_DIR ; + if (docPath.IsEmpty()) + docPath = loadPath + wxT("/..") DOC_DIR ; + + backupExecutable = path.FindValidPath(wxT("pg_dump")); + restoreExecutable = path.FindValidPath(wxT("pg_restore")); + #else backupExecutable = path.FindValidPath(wxT("pg_dump")); @@ -200,6 +230,7 @@ docPath = DATA_DIR DOC_DIR; else docPath = loadPath + wxT("/..") DOC_DIR; + #endif