=== modified file 'mixxx/src/configobject.cpp'
--- mixxx/src/configobject.cpp	2012-07-08 23:27:47 +0000
+++ mixxx/src/configobject.cpp	2012-08-07 04:54:12 +0000
@@ -325,59 +325,70 @@
 QString ConfigObject<ValueType>::getResourcePath()
 {
     //
-    // Find the config path, path where midi configuration files, skins etc. are stored.
+    // Find the config path, path where midi configuration files, skins 
+    // etc. are stored.
     // On Unix the search order is whats listed in mixxx.cfg, then UNIX_SHARE_PATH
     // On Windows it is always (and only) app dir.
-    // On OS X it is the current directory and then the Resources/ dir in the app bundle
+    // On OS X it is the current directory and then the Resources/ dir in the 
+    // app bundle
     //
-    QString qResourcePath; // TODO: this only changes once (on first load) during a run should make this a singleton.
+    // TODO: this only changes once (on first load) during a run should 
+    // make this a singleton.
+    QString qResourcePath; 
+
+    QList<QString> developerRelativePaths;
+    developerRelativePaths << "../res" << "res";
 
     // Try to read in the resource directory from the command line
     qResourcePath = CmdlineArgs::Instance().getResourcePath();
+    QString binaryPath = QCoreApplication::applicationDirPath();
+    QFileInfo configPath = QFileInfo(getValueString(ConfigKey("[Config]","Path")));
+
+    // Check for relative paths in source tree for developer use 
+    if (qResourcePath.isNull() || qResourcePath.isEmpty()) {
+        QListIterator<QString> i(developerRelativePaths);
+        QString developerResPath;
+        while (i.hasNext()) {
+            developerResPath = QFileInfo(binaryPath,i.next()).absoluteFilePath();
+            // Check some directories and files to make sure we are not 
+            // trying to use a random directory called res
+            if (!QFileInfo(developerResPath).isDir()) 
+                continue;
+            if (!QFileInfo(developerResPath,QString("skins")).isDir())
+                continue;
+            if (!QFileInfo(developerResPath,QString("controllers")).isDir())
+                continue;
+            if (!QFileInfo(developerResPath,QString("keyboard")).isDir())
+                continue;
+            if (!QFileInfo(developerResPath,QString("schema.xml")).isFile())
+                continue;
+
+            // Looks like legit mixxx source tree res directory: use it
+            qResourcePath = developerResPath;
+            break;
+        }
+    }
+
+    // Try to use path configured to mixxx config
+    if ((qResourcePath.isNull() || qResourcePath.isEmpty()) && configPath.exists()) 
+        qResourcePath = configPath.absoluteFilePath();
 
     if (qResourcePath.isNull() || qResourcePath.isEmpty()) {
 #ifdef __UNIX__
-    // On Linux, check if the path is stored in the configuration database.
-    if (getValueString(ConfigKey("[Config]","Path")).length()>0 && QDir(getValueString(ConfigKey("[Config]","Path"))).exists())
-        qResourcePath = getValueString(ConfigKey("[Config]","Path"));
-    else
-    {
-        // Set the path according to the compile time define, UNIX_SHARE_PATH
         qResourcePath = UNIX_SHARE_PATH;
-    }
 #endif
 #ifdef __WINDOWS__
-    // On Windows, set the config dir relative to the application dir
-    qResourcePath = QCoreApplication::applicationDirPath();
+        // On Windows, set the config dir relative to the application dir
+        qResourcePath = binaryPath;
 #endif
 #ifdef __APPLE__
-    /*
-    // Set the path relative to the bundle directory
-    CFURLRef pluginRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());
-    CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef, kCFURLPOSIXPathStyle);
-    char utf8path[256];
-    //Attempt to decode obtain the macPath string as UTF-8
-    if (CFStringGetCString(macPath, utf8path, sizeof(utf8path), kCFStringEncodingUTF8))
-    {
-        qConfigPath.fromUtf8(utf8path);
-    }
-    else {
-        //Fallback on the "system encoding"... (this is just our old code, which probably doesn't make any sense
-         //since it plays roullette with the type of text encoding)
-        qConfigPath = CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding());
-    }
-    qConfigPath.append("/Contents/Resources/"); //XXX this should really use QDir, this entire function should
-    */
-    QString mixxxPath = QCoreApplication::applicationDirPath();
-    if (mixxxPath.endsWith("osx_build"))   //Development configuration
-        qResourcePath = mixxxPath + "/../res";
-    else //Release configuraton
-	    qResourcePath = mixxxPath + "/../Resources";
+        // On OS/X, set the config dir relative to binary bundle path
+        qResourcePath = QFileInfo(binaryPath,"../Resources").absoluteFilePath();
 #endif
-    } else {
-        qDebug() << "Setting qResourcePath from location in resourcePath commandline arg:" << qResourcePath;
     }
-	if (qResourcePath.length() == 0) qCritical() << "qConfigPath is empty, this can not be so -- did our developer forget to define one of __UNIX__, __WINDOWS__, __APPLE__??";
+	if (qResourcePath.length() == 0)
+        qCritical() << "qConfigPath is empty, this can not be so -- did our developer forget to define one of __UNIX__, __WINDOWS__, __APPLE__??";
+
     // If the directory does not end with a "/", add one
     if (!qResourcePath.endsWith("/"))
         qResourcePath.append("/");
@@ -385,7 +396,6 @@
     return qResourcePath;
 }
 
-
 template <class ValueType> ConfigObject<ValueType>::ConfigObject(QDomNode node) {
 
     if (!node.isNull() && node.isElement()) {
@@ -410,7 +420,6 @@
     return configFileInfo.absoluteDir().absolutePath();
 }
 
-
 template class ConfigObject<ConfigValue>;
 template class ConfigObject<ConfigValueKbd>;
 

