Skip to content

Commit

Permalink
[Android] Add support for Apple Silicon (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
subdan authored Jan 11, 2022
1 parent e867c2e commit cf0ce2d
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions Sources/FigmaExport/Output/VectorDrawableConverter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,27 @@ final class VectorDrawableConverter {
}

private func runVdTool(with arguments: [String], errorPipe: Pipe?, outputPipe: Pipe? = nil) throws {
var executableURLs = [
URL(fileURLWithPath: "/usr/local/bin/vd-tool"),
URL(fileURLWithPath: "/opt/homebrew/bin/vd-tool"),
URL(fileURLWithPath: "./vd-tool/bin/vd-tool")
]

let task = Process()
task.executableURL = URL(fileURLWithPath: "/usr/local/bin/vd-tool")
task.arguments = arguments

task.standardOutput = outputPipe
task.standardError = errorPipe

do {
try task.run()
} catch {
task.executableURL = URL(fileURLWithPath: "./vd-tool/bin/vd-tool")
try task.run()
}

task.waitUntilExit()
repeat {
task.executableURL = executableURLs.removeFirst()
do {
try task.run()
task.waitUntilExit()
return
} catch {
continue
}
} while !executableURLs.isEmpty
}
}

Expand Down

0 comments on commit cf0ce2d

Please sign in to comment.