The [*type* property](https://developer.mozilla.org/en-US/docs/Web/Apps/Manifest#type) is optional, and many apps don't set it, so checking *app.manifest.type* isn't a reliable way to determine that an app is packaged. Instead, check *app.type*, which is either `local`, `hosted`, or `generated`, where `local` means "packaged".

Also, it isn't necessary to add a *fileName* property to the app record, because the app ID is the file path for packaged apps. So you just need to pass the ID into the validator function and use *File.basename* to extract the name of the file from it.

Finally, I would move the *app.type* check up the caller ( *validateApp* ), so it only calls *Validator.validateManifestFile* when the app is packaged, i.e.:

      validateApp: function(id, next) {
        let app = simulator.apps[id];
        …
        if (app.type == "local") {
          Validator.validateManifestFile(app.validation.errors,
                                         app.validation.warnings,
                                         id);
        }

Then, in validator.js:

```
// at the top of the file:
const File = require("file");
…
exports.validateManifestFile = function(errors, warnings, path) {
  if (File.basename(path) !== "manifest.webapp") {
    errors.push("the manifest file must be called 'manifest.webapp'");
  }
}
```