Skip to content

Commit

Permalink
workaround LICENSE without extension
Browse files Browse the repository at this point in the history
fixes #74
  • Loading branch information
joaomoreno committed Mar 1, 2016
1 parent 055323b commit 4f8cc54
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,14 @@ class LicenseProcessor extends BaseProcessor {

onFile(file: IFile): Promise<IFile> {
if (!this.didFindLicense) {
const normalizedPath = util.normalize(file.path);
let normalizedPath = util.normalize(file.path);

if (this.filter(normalizedPath)) {
if (!path.extname(normalizedPath)) {
file.path += '.txt';
normalizedPath += '.txt';
}

this.assets.push({ type: 'Microsoft.VisualStudio.Services.Content.License', path: normalizedPath });
this.vsix.license = normalizedPath;
this.didFindLicense = true;
Expand Down
3 changes: 3 additions & 0 deletions src/test/package.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ describe('toVsixManifest', () => {
assert.ok(result.PackageManifest.Metadata[0].License);
assert.equal(result.PackageManifest.Metadata[0].License.length, 1);
assert.equal(result.PackageManifest.Metadata[0].License[0], 'extension/LICENSE.md');
assert.equal(result.PackageManifest.Assets[0].Asset.length, 2);
assert.equal(result.PackageManifest.Assets[0].Asset[1].$.Type, 'Microsoft.VisualStudio.Services.Content.License');
assert.equal(result.PackageManifest.Assets[0].Asset[1].$.Path, 'extension/LICENSE.md');
});
});

Expand Down

0 comments on commit 4f8cc54

Please sign in to comment.