From d722fa42df16e9a74da109582e915c63f59a7a29 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 29 Mar 2014 15:17:56 -0600 Subject: [PATCH] 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. --- pkgs/gui-pkgs/gui-lib/mred/private/wx/gtk/unique.rkt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/gui-pkgs/gui-lib/mred/private/wx/gtk/unique.rkt b/pkgs/gui-pkgs/gui-lib/mred/private/wx/gtk/unique.rkt index 6917167b34..9be844355d 100644 --- a/pkgs/gui-pkgs/gui-lib/mred/private/wx/gtk/unique.rkt +++ b/pkgs/gui-pkgs/gui-lib/mred/private/wx/gtk/unique.rkt @@ -58,7 +58,10 @@ [vec (read p)]) (for-each 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)) (define-mz gethostname (_fun _pointer _long -> _int) @@ -89,7 +92,12 @@ (let ([msg (unique_message_data_new)] [b (let ([o (open-output-bytes)]) (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) (get-output-bytes o))]) (unique_message_data_set msg b (bytes-length b))