ymotongpoo / vsc-licenser

License handler extension for Visual Studio Code.
Apache License 2.0
45 stars 40 forks source link

This extension really struggles with custom licenses #90

Closed smac89 closed 3 years ago

smac89 commented 3 years ago

Runtime environment

Behaviors

  1. Trying to insert a custom header: The header file is at the base of my workspace in a file called HEADER.txt. I specify this name in the customHeaderFile settings.
  2. Trying to create a LICENSE file from a custom header: Once again, I have set customHeaderFile to HEADER.txt

Expected behavior

  1. The HEADER.txt in the workspace should be picked and inserted into the current file
  2. The extension should create a file called LICENSE in the root of my workspace

Actual behavior

Steps to reproduce the issue

See descriptions above


If it helps, here are the contents of HEADER.txt

Copyright (C) @YEAR@ @AUTHOR@

This file is part of @PROJECT@.

@PROJECT@ is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

@PROJECT@ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with @PROJECT@.  If not, see <https://www.gnu.org/licenses/>.

EDIT

It may not be clear from my report, but I should also add that doing any of the above with the pre-installed licenses, actually works. So the problem is definitely with the way custom licenses are handled, and I have a hunch it may be due to path issues, just from a casual glance into the extension code. You may want to be using the workspace api for reading files from the current workspace, otherwise if you're using just fs, you should supply it the full path to the file if the file name is not absolute. Just a hint in case you're not already doing that.