--- a/src/hugin1/base_wx/platform.cpp
+++ b/src/hugin1/base_wx/platform.cpp
@@ -28,64 +28,31 @@
 
 #include <hugin_utils/utils.h>
 
-#if defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
+#if defined __WXMAC__
 
 #include <CoreFoundation/CFBundle.h>
 
-wxString MacGetPathTOBundledResourceFile(CFStringRef filename)
-{
-    wxString theResult = wxT("");
-
-    CFBundleRef mainbundle = CFBundleGetMainBundle();
-    if(mainbundle == NULL)
-    {
-        DEBUG_ERROR("Mac: Not bundled");
-    }
-    else
-    {
-        CFURLRef XRCurl = CFBundleCopyResourceURL(mainbundle, filename, NULL, NULL);
-        if(XRCurl == NULL)
-        {
-            DEBUG_ERROR("Mac: Cannot locate the file in bundle.");
-        }
-        else
-        {
-            CFStringRef pathInCFString = CFURLCopyFileSystemPath(XRCurl, kCFURLPOSIXPathStyle);
-            CFRelease( XRCurl );
-            if(pathInCFString == NULL)
-            {
-                DEBUG_ERROR("Mac: Failed to get URL in CFString");
-            }
-            else
-            {
-                CFRetain( pathInCFString );
-                theResult = wxMacCFStringHolder(pathInCFString).AsString(wxLocale::GetSystemEncoding());
-                DEBUG_INFO("Mac: returned the resource file's path in the application bundle");
-            }
-        }
-    }
-    return theResult;
-}
-
-wxString MacGetPathTOBundledExecutableFile(CFStringRef filename)
-{
-    wxString theResult = wxT("");
-
-    CFBundleRef mainbundle = CFBundleGetMainBundle();
-    if(mainbundle == NULL)
-    {
-        DEBUG_ERROR("Mac: Not bundled");
-    }
-    else
-    {
-        CFURLRef PTOurl = CFBundleCopyAuxiliaryExecutableURL(mainbundle, filename);
+wxString MacPathToMainBundleExecutable(CFStringRef bundlePath)
+{
+    wxString theResult = wxT("");
+
+    CFBundleRef bundle = CFBundleCreate(NULL, bundlePath);
+    if(bundle == NULL)
+    {
+        DEBUG_ERROR("Mac: CFBundleCreate (" << bundlePath << " ) failed" );
+    }
+    else
+    {
+        CFURLRef PTOurl = CFBundleCopyExecutableURL(bundle);
+        CFRelease( bundle );
         if(PTOurl == NULL)
         {
-            DEBUG_ERROR("Mac: Cannot locate the file in the bundle.");
+            DEBUG_ERROR("Mac: Cannot locate the executable in the bundle.");
         }
         else
         {
             CFURLRef PTOAbsURL = CFURLCopyAbsoluteURL( PTOurl );
+            CFRelease( PTOurl );
             if(PTOAbsURL == NULL)
             {
                 DEBUG_ERROR("Mac: Cannot convert the file path to absolute");
@@ -105,12 +72,12 @@
                     DEBUG_INFO("Mac: returned the executable's full path in the application bundle");
                 }
             }
-            CFRelease( PTOurl );
-        }
-    }
-    return theResult;
-}
-
+        }
+    }
+    return theResult;
+}
+
+#if defined MAC_SELF_CONTAINED_BUNDLE
 
 wxString MacGetPathTOBundledAppMainExecutableFile(CFStringRef filename)
 {
@@ -176,6 +143,85 @@
     return theResult;
 }
 
+wxString MacGetPathTOBundledResourceFile(CFStringRef filename)
+{
+    wxString theResult = wxT("");
+
+    CFBundleRef mainbundle = CFBundleGetMainBundle();
+    if(mainbundle == NULL)
+    {
+        DEBUG_ERROR("Mac: Not bundled");
+    }
+    else
+    {
+        CFURLRef XRCurl = CFBundleCopyResourceURL(mainbundle, filename, NULL, NULL);
+        if(XRCurl == NULL)
+        {
+            DEBUG_ERROR("Mac: Cannot locate the file in bundle.");
+        }
+        else
+        {
+            CFStringRef pathInCFString = CFURLCopyFileSystemPath(XRCurl, kCFURLPOSIXPathStyle);
+            CFRelease( XRCurl );
+            if(pathInCFString == NULL)
+            {
+                DEBUG_ERROR("Mac: Failed to get URL in CFString");
+            }
+            else
+            {
+                CFRetain( pathInCFString );
+                theResult = wxMacCFStringHolder(pathInCFString).AsString(wxLocale::GetSystemEncoding());
+                DEBUG_INFO("Mac: returned the resource file's path in the application bundle");
+            }
+        }
+    }
+    return theResult;
+}
+
+wxString MacGetPathTOBundledExecutableFile(CFStringRef filename)
+{
+    wxString theResult = wxT("");
+
+    CFBundleRef mainbundle = CFBundleGetMainBundle();
+    if(mainbundle == NULL)
+    {
+        DEBUG_ERROR("Mac: Not bundled");
+    }
+    else
+    {
+        CFURLRef PTOurl = CFBundleCopyAuxiliaryExecutableURL(mainbundle, filename);
+        if(PTOurl == NULL)
+        {
+            DEBUG_ERROR("Mac: Cannot locate the file in the bundle.");
+        }
+        else
+        {
+            CFURLRef PTOAbsURL = CFURLCopyAbsoluteURL( PTOurl );
+            if(PTOAbsURL == NULL)
+            {
+                DEBUG_ERROR("Mac: Cannot convert the file path to absolute");
+            }
+            else
+            {
+                CFStringRef pathInCFString = CFURLCopyFileSystemPath(PTOAbsURL, kCFURLPOSIXPathStyle);
+                CFRelease( PTOAbsURL );
+                if(pathInCFString == NULL)
+                {
+                    DEBUG_ERROR("Mac: Failed to get URL in CFString");
+                }
+                else
+                {
+                    CFRetain( pathInCFString );
+                    theResult =  wxMacCFStringHolder(pathInCFString).AsString(wxLocale::GetSystemEncoding());
+                    DEBUG_INFO("Mac: returned the executable's full path in the application bundle");
+                }
+            }
+            CFRelease( PTOurl );
+        }
+    }
+    return theResult;
+}
+
 
 wxString MacGetPathTOUserDomainTempDir()
 {
@@ -199,4 +245,6 @@
     return tmpDirPath;
 }
 
-#endif
+#endif // MAC_SELF_CONTAINED_BUNDLE
+
+#endif // __WXMAC__