title: HTML5 File System API error "Cannot read property 'root' of undefined"
body: <p>When I try to write a file I am getting this error in Google Chrome:</p>
  
  <pre><code>Uncaught TypeError: Cannot read property 'root' of undefined FileSystemApi.html:29
  onButtonSaveClick FileSystemApi.html:29
  onclick
  </code></pre>
  
  <p>My sample code is as follows</p>
  
  <pre><code>var fileSys;
  
  $(function () {
      initFileSystem(onInitFileSystemSuccess);
  });
  
  function onInitFileSystemSuccess(fs) {
      console.log('Opened file system: ' + fs.name);
      fileSys = fs;
  }
  
  function onButtonSaveClick() {
      alert('1');
      var fileName = $("#fileName").val();
      alert(fileName);
      var fileContent = $("#fileContent").val();
      alert(fileContent);
      alert(fileSys.root);
      fileSys.root.getFile(fileName, {
              create: true,
              exclusive: true
          },
          function (fileEntry) {
              alert('2');
              console.log('File opened: ' + fileEntry.fullPath);
              fileEntry.createWriter(function (fileWriter) {
                  var blob = new Blob([fileContent], {
                      type: 'text/plain'
                  });
                  fileWriter.write(blob);
                  alert('done');
              }, onFileSystemError);
          }, onFileSystemError);
  }
  </code></pre>
  
  <p>Would anyone be able to point out the problem(s), and, if so, contribute a solution?</p>