oslllo / svg-fixer

Converts SVG Strokes To Fill.
https://docs-oslllo-com.onrender.com/svg-fixer/master
MIT License
213 stars 19 forks source link

destination only accept folder path, no filename #70

Closed iyh closed 2 years ago

iyh commented 2 years ago

If user want change the output filename, for eg. oslllo-svg-fixer -s \!.svg -d fixed/exclamationmark.svg will produce error:

ERR: destination path fixed/exclamationmark.svg does not exist.

STACK: TypeError: destination path fixed/exclamationmark.svg does not exist.
    at Object.invalidPathError (~/.nvm/versions/node/v16.13.2/lib/node_modules/oslllo-svg-fixer/src/error.js:27:10)
    at new Location (~/.nvm/versions/node/v16.13.2/lib/node_modules/oslllo-svg-fixer/src/location.js:21:19)
...

so maybe check if destination has ext? path.parse(destination).ext before check exists /src/location.js#L19

Ghustavh97 commented 2 years ago

Hi, thanks for the issue.

Unfortunately the package was made with fixing many svgs at once in mind not just one with a different output name.

Is there a really good use case for this instead of just renaming it after it was fixed?, or is this just a quality of life change that you need?

so maybe check if destination has ext? path.parse(destination).ext before check exists /src/location.js#L19

Unfortunately its a simple problem that requires alot of changes from what I can see since the package is always expecting a directory for the destination.

If you have a fix for this in mind a PR would be greatly appreciated.

iyh commented 2 years ago

I get your point, your using case is more effective , convert all svgs even those ones is OK in icomoon. (for eg. only some of svgs in one icon pack are Strokes)