Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 04a21cb

Browse files
committed
Merge branch 'PGPRO10' into PGPROEE10
2 parents a6fdd91 + e80337e commit 04a21cb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/bin/psql/input.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <sys/types.h>
1414
#include <sys/stat.h>
1515
#include <errno.h>
16+
#include <wchar.h>
1617
#endif
1718
#include <fcntl.h>
1819
#include <limits.h>
@@ -385,13 +386,18 @@ initializeInput(int flags)
385386
#ifdef HAVE_WIN32_LIBEDIT
386387
{
387388
struct _stat buffer;
389+
wchar_t *widepath;
390+
388391
psql_history = psprintf("%s\\%s", home, PSQLHISTORY);
392+
389393
/* Check if home exists and create it if needed,
390394
because there is no guarantee that it exits on Win32 */
391-
if (_stat(home,&buffer)!=0 && errno == ENOENT)
392-
{
393-
_mkdir(home);
395+
widepath=malloc(sizeof(wchar_t)*(strlen(home)+1));
396+
MultiByteToWideChar(CP_UTF8,0,home,-1,widepath,strlen(home)+1);
397+
if (_wstat(widepath,&buffer)!=0 && errno == ENOENT) {
398+
_wmkdir(widepath);
394399
}
400+
free(widepath);
395401
}
396402
#else
397403
psql_history = psprintf("%s/%s", home, PSQLHISTORY);

0 commit comments

Comments
 (0)