pbxFile: Added defaultPath,defaultGroup,defaultSourcetree,defaultEncoding methods, using updated dictionaries.
diff --git a/lib/pbxFile.js b/lib/pbxFile.js
index c428221..5002b04 100644
--- a/lib/pbxFile.js
+++ b/lib/pbxFile.js
@@ -91,43 +91,59 @@
     return extension;
 }
 
+function defaultEncoding(fileRef) {
+    var encoding = ENCODING_BY_FILETYPE[fileRef.lastKnownFileType];
 
-    // dunno
-    return 'unknown';
-}
-
-function fileEncoding(file) {
-    if (file.lastType != BUNDLE && !file.customFramework) {
-        return DEFAULT_FILE_ENCODING;
+    if (encoding) {
+        return encoding;
     }
 }
 
-function defaultSourceTree(file) {
-    if (( file.lastType == DYLIB || file.lastType == FRAMEWORK ) && !file.customFramework) {
-        return 'SDKROOT';
-    } else {
-        return DEFAULT_SOURCE_TREE;
+function defaultGroup(fileRef) {
+    var groupName = GROUP_BY_FILETYPE[fileRef.lastKnownFileType];
+
+    if (!groupName) {
+        return DEFAULT_GROUP;
     }
+
+    return groupName;
 }
 
-function correctPath(file, filepath) {
-    if (file.lastType == FRAMEWORK && !file.customFramework) {
-        return 'System/Library/Frameworks/' + filepath;
-    } else if (file.lastType == DYLIB) {
-        return 'usr/lib/' + filepath;
-    } else {
-        return filepath;
+function defaultSourcetree(fileRef) {
+    var sourcetree = SOURCETREE_BY_FILETYPE[fileRef.lastKnownFileType];
+
+    if (fileRef.customFramework) {
+        return filePath;
     }
+
+    if (fileRef.explicitFileType) {
+        return DEFAULT_PRODUCT_SOURCETREE;
+    }
+
+    return sourcetree;
 }
 
-function correctGroup(file) {
-    if (file.lastType == SOURCE_FILE) {
-        return 'Sources';
-    } else if (file.lastType == DYLIB || file.lastType == ARCHIVE || file.lastType == FRAMEWORK) {
-        return 'Frameworks';
-    } else {
-        return 'Resources';
+function defaultPath(fileRef, filePath) {
+    var defaultPath = PATH_BY_FILETYPE[fileRef.lastKnownFileType];
+
+    if (fileRef.customFramework) {
+        return filePath;
     }
+    if (defaultPath) {
+        return path.join(defaultPath, filePath);
+    }
+
+    return filePath;
+}
+
+function defaultGroup(fileRef) {
+    var groupName = GROUP_BY_FILETYPE[fileRef.lastKnownFileType];
+
+    if (!groupName) {
+        return DEFAULT_GROUP;
+    }
+
+    return defaultGroup;
 }
 
 function pbxFile(filepath, opt) {
@@ -136,9 +152,9 @@
     this.lastType = opt.lastType || detectLastType(filepath);
 
     // for custom frameworks
-    if(opt.customFramework == true) {
-      this.customFramework = true;
-      this.dirname = path.dirname(filepath);
+    if (opt.customFramework == true) {
+        this.customFramework = true;
+        this.dirname = path.dirname(filepath);
     }
 
     this.basename = path.basename(filepath);
@@ -149,12 +165,12 @@
     this.fileEncoding = opt.fileEncoding || fileEncoding(this);
 
     if (opt.weak && opt.weak === true) 
-      this.settings = { ATTRIBUTES: ['Weak'] };
+        this.settings = { ATTRIBUTES: ['Weak'] };
 
     if (opt.compilerFlags) {
         if (!this.settings)
-          this.settings = {};
-          this.settings.COMPILER_FLAGS = util.format('"%s"', opt.compilerFlags);
+            this.settings = {};
+        this.settings.COMPILER_FLAGS = util.format('"%s"', opt.compilerFlags);
     }
 }