changeset 31355:d9db23719cf9

merge of '148e99c7c4a60cc18826232bd8b3270cbdddc7b5' and '89847795e1c9cbdd51c942ae1e506e6060ac2235'
author Daniel Atallah <daniel.atallah@gmail.com>
date Mon, 08 Nov 2010 22:51:35 +0000
parents 4de2b3adc823 (diff) a4f3d21f393c (current diff)
children 4ba00731d066
files
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/win32/untar.c	Mon Nov 08 17:05:53 2010 +0000
+++ b/pidgin/win32/untar.c	Mon Nov 08 22:51:35 2010 +0000
@@ -578,7 +578,8 @@
  */
 int untar(const char *filename, const char* destdir, untar_opt options) {
 	int ret=1;
-	char curdir[_MAX_PATH];
+	wchar_t curdir[_MAX_PATH];
+	wchar_t *w_destdir;
 	untarops = options;
 	/* open the archive */
 	inname = filename;
@@ -589,13 +590,15 @@
 		return 0;
 	}
 
+	w_destdir = g_utf8_to_utf16(destdir, -1, NULL, NULL, NULL);
+
 	/* Set current directory */
-	if(!GetCurrentDirectory(_MAX_PATH, curdir)) {
+	if(!GetCurrentDirectoryW(_MAX_PATH, curdir)) {
 		untar_error("Could not get current directory (error %lu).\n", GetLastError());
 		fclose(infp);
 		return 0;
 	}
-	if(!SetCurrentDirectory(destdir)) {
+	if(!SetCurrentDirectoryW(w_destdir)) {
 		untar_error("Could not set current directory to (error %lu): %s\n", GetLastError(), destdir);
 		fclose(infp);
 		return 0;
@@ -614,12 +617,14 @@
 			fclose(outfp);
 			outfp = NULL;
 		}
-		if(!SetCurrentDirectory(curdir)) {
+		if(!SetCurrentDirectoryW(curdir)) {
 			untar_error("Could not set current dir back to original (error %lu).\n", GetLastError());
 			ret=0;
 		}
 	}
 
+	g_free(w_destdir);
+
 	/* close the archive file. */
 	fclose(infp);