ScerIO / icon_font_generator

☣️ Flutter Icon Font Generator
https://pub.dev/packages/icon_font_generator
Other
96 stars 50 forks source link

Tool permanently unusable when accidentally using a dash in a svg filename. #3

Closed GeertJohan closed 4 years ago

GeertJohan commented 4 years ago

I had an .svg file with a dash in it and ran the generator. The generator failed with the following output:

Generated /home/geertjohan/.pub-cache/global_packages/icon_font_generator/temp_font/IrmaIcons.ttf
Generated /home/geertjohan/.pub-cache/global_packages/icon_font_generator/map.json
Done
Unhandled exception:
Invalid argument(s): Register has invalid characters arrow-down
#0      new Register (package:register/register.dart:15:7)
#1      generateFlutterClass.<anonymous closure> (package:icon_font_generator/generate_flutter_class.dart:25:40)
#2      MappedIterator.moveNext (dart:_internal/iterable.dart:393:18)
#3      Iterable.join (dart:core/iterable.dart:370:23)
#4      generateFlutterClass (package:icon_font_generator/generate_flutter_class.dart:46:57)
<asynchronous suspension>
#5      GenerateCommand.run (file:///home/geertjohan/.pub-cache/hosted/pub.dartlang.org/icon_font_generator-0.0.7/bin/icon_font_generator.dart:186:39)
<asynchronous suspension>
#6      CommandRunner.runCommand (package:args/command_runner.dart:197:27)
<asynchronous suspension>
#7      CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#8      new Future.sync (dart:async/future.dart:224:31)
#9      CommandRunner.run (package:args/command_runner.dart:112:14)
#10     main (file:///home/geertjohan/.pub-cache/hosted/pub.dartlang.org/icon_font_generator-0.0.7/bin/icon_font_generator.dart:13:18)
<asynchronous suspension>
#11     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:303:32)
#12     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

After renaming the arrow-down.svg to arrow_down.svg, the tool keeps complaining with the same error. I found that the issue is fixed after removing map.json, temp_fonts and temp_icons from /home/geertjohan/.pub-cache/global_packages/icon_font_generator. arrow-down.svg was being cached in the temp dir, but the temp dir is not removed when the tool exits with an error.

I think the solution is to always cleanup the temp dirs, even if the tool exits with an error.

SergeShkurko commented 4 years ago

Thanks for feedback, fixed in v1.0.0