code: function updatePathInternal(sourcePath, targetPath, options, log) {
      var rootDir = (options && options.rootDir) || "";
      var targetFullPath = path.join(rootDir, targetPath);
      var targetStats = fs.existsSync(targetFullPath) ? fs.statSync(targetFullPath) : null;
      var sourceStats = null;
  
      if (sourcePath) {
          // A non-null source path was specified. It should exist.
          var sourceFullPath = path.join(rootDir, sourcePath);
          if (!fs.existsSync(sourceFullPath)) {
              throw new Error("Source path does not exist: " + sourcePath);
          }
  
          sourceStats = fs.statSync(sourceFullPath);
  
          // Create the target's parent directory if it doesn't exist.
          var parentDir = path.dirname(targetFullPath);
          if (!fs.existsSync(parentDir)) {
              shell.mkdir("-p", parentDir);
          }
      }
  
      return updatePathWithStats(sourcePath, sourceStats, targetPath, targetStats, options, log);
  }
docs: Helper for updatePath and updatePaths functions. Queries stats for source and target
  and ensures target directory exists before copying a file.