Closed maxischubert93 closed 3 years ago
I'll think about it on the weekend and get back to you.
Converting files one by one is about 10 times slower than batch converting. So I think we shouldn't stop using batch convert.
Solution
vd-tool -c -in "path_to_directory"
vd-tool -c -in "path_to_file"
How to check for an error:
let errorPipe = Pipe()
task.standardError = errorPipe
let errorData = errorPipe.fileHandleForReading.readDataToEndOfFile()
let error = String(decoding: errorData, as: UTF8.self)
What do you think about this solution?
I already tried this approach, sadly the vd-tool doesn't provide any useful information within the standardError. You basically get the same logs you already get from just executing it the regular way. Same thing regarding the exit code. Even tough errors happen within the vd-tool, the exit code just stays 0.
Step 1. Run vdtool
for a directory.
Search is not supported
substring in the error
string. If found go to step 2.
Step 2. Run vdtool
for each file. User can read logs and find “bad” files.
I adjusted the PR to first run vd-tool
in a directory. And then execute the tool per file.
I also filter the log outputs from vd-tool
a little to make the whole process more readable and easier understandable from the command line.
Thanks! I will check it by the end of the week.
I encountered a problem with exporting icons to XML for android. In case there are unsupported XML-Tags in the SVG files for the vd-tool it only tells you that there was an error. But it does not tell you in which file. So it is pretty hard to see which assets in Figma are not built correctly.
This is a suggestion to start a separate process for each file, which makes it possible to read from the logs, which file had issues while converting.
The downside is, that starting a process for each file makes the whole thing take way longer. A proper solution would probably be to adjust the vd-tool, which is not easily doable, as this tool is also just a packaging of the Android Studio VectorDrawable CLI tool.
Maybe you have a suggestion to improve this behavior.