# HG changeset patch # User Frank Benoit # Date 1200871359 -3600 # Node ID 73b4c55700ece0bcb2826b7209d4ad7c49dc4904 # Parent 1feb02b24d1c251758ad5b735ccbe9a1021f982b Fix in DirectoryDialog string convertion diff -r 1feb02b24d1c -r 73b4c55700ec dwt/widgets/DirectoryDialog.d --- a/dwt/widgets/DirectoryDialog.d Mon Jan 21 00:17:23 2008 +0100 +++ b/dwt/widgets/DirectoryDialog.d Mon Jan 21 00:22:39 2008 +0100 @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -173,10 +173,11 @@ if (response is OS.GTK_RESPONSE_OK) { auto path = OS.gtk_file_chooser_get_filename (handle); if (path !is null) { - auto utf8Ptr = OS.g_filename_to_utf8 (path, -1, null, null, null); + uint items_written; + auto utf8Ptr = OS.g_filename_to_utf8 (path, -1, null, &items_written, null); OS.g_free (path); if (utf8Ptr !is null) { - answer = tango.stdc.stringz.fromUtf8z( utf8Ptr ).dup; + answer = utf8Ptr[ 0 .. items_written ].dup; filterPath = answer[ tango.text.Util.locatePatternPrior( answer, SEPARATOR ) + 1 .. $ ]; OS.g_free (utf8Ptr); } @@ -227,9 +228,10 @@ int response = OS.gtk_dialog_run (handle); if (response is OS.GTK_RESPONSE_OK) { char* fileNamePtr = OS.gtk_file_selection_get_filename (handle); - char* utf8Ptr = OS.g_filename_to_utf8 (fileNamePtr, -1, null, null, null); + uint items_written; + char* utf8Ptr = OS.g_filename_to_utf8 (fileNamePtr, -1, null, &items_written, null); if (utf8Ptr !is null) { - char[] osAnswer = tango.stdc.stringz.fromUtf8z(utf8Ptr); + char[] osAnswer = utf8Ptr[ 0 .. items_written ]; if (osAnswer.length !is 0) { /* remove trailing separator, unless root directory */ if ( osAnswer != SEPARATOR && osAnswer[ $-1 .. $ ] == SEPARATOR ) {