Index: sasview/setup_exe.py
===================================================================
--- sasview/setup_exe.py	(revision 55523963f660e43a5bc5c95f4eadcae4ed5f69c3)
+++ sasview/setup_exe.py	(revision 3aa2f3c125b599a9852457e58e79f6e64a3d44dc)
@@ -33,7 +33,7 @@
 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 platform = '%s-%s'%(get_platform(), sys.version[:3])
+doc_path = os.path.join(root, 'build', 'lib.'+platform, 'doc')
 build_path = os.path.join(root, 'sasview-install', 'Lib', 'site-packages')
 sys.path.insert(0, build_path)
-doc_path = os.path.join(root, 'build', 'lib.'+platform, 'doc')
 
 from sas.sasview import local_config
@@ -177,7 +177,4 @@
 matplotlibdata = findall(matplotlibdatadir)
 
-site_loc = get_python_lib()
-opencl_include_dir = os.path.join(site_loc, "pyopencl", "cl")
-
 DATA_FILES = []
 
@@ -243,5 +240,4 @@
 images_dir = local_config.icon_path
 media_dir = local_config.media_path
-images_dir = local_config.icon_path
 test_dir = local_config.test_path
 test_1d_dir = os.path.join(test_dir, "1d_data")
@@ -260,21 +256,23 @@
 # Copying the sample data user data
 for f in findall(test_1d_dir):
-    DATA_FILES.append(("test\\1d_data", [f]))
+    DATA_FILES.append((os.path.join("test","1d_data"), [f]))
 
 # Copying the sample data user data
 for f in findall(test_2d_dir):
-    DATA_FILES.append(("test\\2d_data", [f]))
+    DATA_FILES.append((os.path.join("test","2d_data"), [f]))
 
 # Copying the sample data user data
 for f in findall(test_save_dir):
-    DATA_FILES.append(("test\\save_states", [f]))
+    DATA_FILES.append((os.path.join("test","save_states"), [f]))
 
 # Copying the sample data user data
 for f in findall(test_upcoming_dir):
-    DATA_FILES.append(("test\\upcoming_formats", [f]))
+    DATA_FILES.append((os.path.join("test","upcoming_formats"), [f]))
 
 # Copying opencl include files
+site_loc = get_python_lib()
+opencl_include_dir = os.path.join(site_loc, "pyopencl", "cl")
 for f in findall(opencl_include_dir):
-    DATA_FILES.append(("includes\\pyopencl", [f]))
+    DATA_FILES.append((os.path.join("includes","pyopencl"), [f]))
 
 # See if the documentation has been built, and if so include it.
Index: sasview/setup_mac.py
===================================================================
--- sasview/setup_mac.py	(revision 899e084c5a4f0e16bee8152f20438288d95e87ec)
+++ sasview/setup_mac.py	(revision 3aa2f3c125b599a9852457e58e79f6e64a3d44dc)
@@ -14,21 +14,24 @@
 import os
 import string
-import pytz
 import sys
-import platform
 #Extending recursion limit
 sys.setrecursionlimit(10000)
 
+import macholib_patch
+
 from distutils.util import get_platform
+from distutils.filelist import findall
+from distutils.sysconfig import get_python_lib
 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 platform = '%s-%s'%(get_platform(),sys.version[:3])
-build_path = os.path.join(root, 'build','lib.'+platform)
-sys.path.insert(0, build_path)
-print "BUILDING PATH INSIDE", build_path
+doc_path = os.path.join(root, 'build', 'lib.'+platform, 'doc')
+env = os.path.join(root, 'sasview-install', 'lib', 'python2.7', 'site-packages')
+#sys.path.insert(0, env)
+
+print "BUILDING PATH INSIDE", env
 
 from sas.sasview import local_config
 
 ICON = local_config.SetupIconFile_mac
-EXTENSIONS_LIST = []
 RESOURCES_FILES = []
 DATA_FILES = []
@@ -71,5 +74,4 @@
 images_dir = local_config.icon_path
 media_dir = local_config.media_path
-images_dir = local_config.icon_path
 test_dir = local_config.test_path
 test_1d_dir = os.path.join(test_dir, "1d_data")
@@ -88,24 +90,25 @@
 # Copying the sample data user data
 for f in findall(test_1d_dir):
-    DATA_FILES.append(("test\\1d_data", [f]))
+    DATA_FILES.append((os.path.join("test","1d_data"), [f]))
 
 # Copying the sample data user data
 for f in findall(test_2d_dir):
-    DATA_FILES.append(("test\\2d_data", [f]))
+    DATA_FILES.append((os.path.join("test","2d_data"), [f]))
 
 # Copying the sample data user data
 for f in findall(test_save_dir):
-    DATA_FILES.append(("test\\save_states", [f]))
+    DATA_FILES.append((os.path.join("test","save_states"), [f]))
 
 # Copying the sample data user data
 for f in findall(test_upcoming_dir):
-    DATA_FILES.append(("test\\upcoming_formats", [f]))
+    DATA_FILES.append((os.path.join("test","upcoming_formats"), [f]))
 
 # Copying opencl include files
+site_loc = get_python_lib()
+opencl_include_dir = os.path.join(site_loc, "pyopencl", "cl")
 for f in findall(opencl_include_dir):
-    DATA_FILES.append(("includes\\pyopencl", [f]))
+    DATA_FILES.append((os.path.join("includes","pyopencl"), [f]))
 
 # See if the documentation has been built, and if so include it.
-doc_path = os.path.join(build_path, "doc")
 print doc_path
 if os.path.exists(doc_path):
Index: src/sas/sasgui/__init__.py
===================================================================
--- src/sas/sasgui/__init__.py	(revision efe730d4bba7a05c203957e4495eece8359fcd77)
+++ src/sas/sasgui/__init__.py	(revision 3aa2f3c125b599a9852457e58e79f6e64a3d44dc)
@@ -1,22 +1,42 @@
+import sys
 import os
+from os.path import exists, expanduser, dirname, realpath, join as joinpath
+
+def dirn(path, n):
+    path = realpath(path)
+    for _ in range(n):
+        path = dirname(path)
+    return path
 
 # Set up config directories
 def make_user_folder():
-    path = os.path.join(os.path.expanduser("~"),'.sasview')
-    if not os.path.exists(path):
+    path = joinpath(expanduser("~"),'.sasview')
+    if not exists(path):
         os.mkdir(path)
     return path
 
+
 def find_app_folder():
-    # If the directory containing sasview.py exists, then we are not running
-    # frozen and the current path is the app path.
-    root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
-    path = os.path.join(root, 'sasview')
-    if os.path.exists(path):
+    # We are starting out with the following info:
+    #     __file__ = .../sas/sasgui/__init__.pyc
+    # Check if the sister path .../sas/sasview exists, and use it as the
+    # app directory.  This will only be the case if the app is not frozen.
+    path = joinpath(dirn(__file__, 2), 'sasview')
+    if exists(path):
         return path
 
-    # If we are running frozen, then skip from:
-    #    library.zip/sas/sasview
-    path = os.path.dirname(os.path.dirname(root))
+    # If we are running frozen, then root is a parent directory
+    if sys.platform == 'darwin':
+        # Here is the path to the file on the mac:
+        #     .../Sasview.app/Contents/Resources/lib/python2.7/site-packages.zip/sas/sasgui/__init__.pyc
+        # We want the path to the Resources directory.
+        path = dirn(__file__, 6)
+    elif os.name == 'nt':
+        # Here is the path to the file on windows:
+        #     ../Sasview/library.zip/sas/sasgui/__init__.pyc
+        # We want the path to the Sasview directory.
+        path = dirn(__file__, 4)
+    else:
+        raise RuntimeError("Couldn't find the app directory")
     return path
 
