diff --git a/lib/asciidoctor-diagram/util/java_socket.rb b/lib/asciidoctor-diagram/util/java_socket.rb index 5f151790..16287ef8 100644 --- a/lib/asciidoctor-diagram/util/java_socket.rb +++ b/lib/asciidoctor-diagram/util/java_socket.rb @@ -13,9 +13,16 @@ def initialize(java, classpath) args = [] args << '-Djava.awt.headless=true' args << '-cp' - args << classpath.flatten.join(File::PATH_SEPARATOR) + # special case for cygwin, it requires path translation for java to work + cygpath = ::Asciidoctor::Diagram.which('cygpath') + if(cygpath != nil) + args << classpath.flatten.map { |jar| `cygpath -w "#{jar}"`.strip }.join(";") + else + args << classpath.flatten.join(";") + end args << 'org.asciidoctor.diagram.CommandServer' - + puts "ARGS:" + puts args @server = IO.popen([java, *args]) @port = @server.readline.strip.to_i @client = TCPSocket.new 'localhost', port