racket/gui gtk: fix -singleInstance for paths that don't work as strings

Just in case a relative path turned into an absolute path doesn't
work as a string, add support for a bytes encoding.
This commit is contained in:
Matthew Flatt 2014-03-29 15:17:56 -06:00
parent facaba6794
commit d722fa42df

View File

@ -58,7 +58,10 @@
[vec (read p)]) [vec (read p)])
(for-each (for-each
queue-file-event queue-file-event
(map string->path (vector->list vec)))))) (map (lambda (s) (if (bytes? s)
(bytes->path s)
(string->path s)))
(vector->list vec))))))
UNIQUE_RESPONSE_OK)) UNIQUE_RESPONSE_OK))
(define-mz gethostname (_fun _pointer _long -> _int) (define-mz gethostname (_fun _pointer _long -> _int)
@ -89,7 +92,12 @@
(let ([msg (unique_message_data_new)] (let ([msg (unique_message_data_new)]
[b (let ([o (open-output-bytes)]) [b (let ([o (open-output-bytes)])
(write (for/vector ([p (in-vector (current-command-line-arguments))]) (write (for/vector ([p (in-vector (current-command-line-arguments))])
(path->string (path->complete-path p))) (define cp (path->complete-path p))
(define s (path->string cp))
(if (equal? cp (string->path s))
s
;; can't represent as string; use bytes
(path->bytes cp)))
o) o)
(get-output-bytes o))]) (get-output-bytes o))])
(unique_message_data_set msg b (bytes-length b)) (unique_message_data_set msg b (bytes-length b))