code: function initPreferences(projectRootPath) {
  
          // Reject the old preferences if they have not completed.
          if (deferredPreferences && deferredPreferences.state() === "pending") {
              deferredPreferences.reject();
          }
  
          deferredPreferences = $.Deferred();
          var pr = ProjectManager.getProjectRoot();
  
          // Open preferences relative to the project root
          // Normally there is a project root, but for unit tests we need to
          // pass in a project root.
          if (pr) {
              projectRootPath = pr.fullPath;
          } else if (!projectRootPath) {
              console.log("initPreferences: projectRootPath has no value");
          }
  
          var path = projectRootPath + Preferences.FILE_NAME;
  
          FileSystem.resolve(path, function (err, file) {
              if (!err) {
                  FileUtils.readAsText(file).done(function (text) {
                      var configObj = null;
                      try {
                          configObj = JSON.parse(text);
                      } catch (e) {
                          // continue with null configObj which will result in
                          // default settings.
                          console.log("Error parsing preference file: " + path);
                          if (e instanceof SyntaxError) {
                              console.log(e.message);
                          }
                      }
                      preferences = new Preferences(configObj);
                      deferredPreferences.resolve();
                  }).fail(function (error) {
                      preferences = new Preferences();
                      deferredPreferences.resolve();
                  });
              } else {
                  preferences = new Preferences();
                  deferredPreferences.resolve();
              }
          });
      }
docs: Init preferences from a file in the project root or builtin
  defaults if no file is found;
  
  @param {string=} projectRootPath - new project root path. Only needed
  for unit tests.