diff options
author | Jan Dubois <jand@activestate.com> | 2006-12-28 10:59:40 -0800 |
---|---|---|
committer | Steve Hay <SteveHay@planit.com> | 2007-01-03 17:56:16 +0000 |
commit | aa2b96eccca93a6fe7c95af71c0b4a027561512b (patch) | |
tree | ff5fb2fd50f7445230b65a61d28265c94d919226 /win32/perlhost.h | |
parent | 23175d88b839c4a83ec070928df0fae32557300b (diff) | |
download | perl-aa2b96eccca93a6fe7c95af71c0b4a027561512b.tar.gz |
[PATCH] Use short pathnames in $^X and @INC if the long form cannot be represented in the current codepage
Date: Thu, 28 Dec 2006 18:59:40 -0800
Message-ID: <vq09p2p09k6rcu6c9t0mab3vnc335ghg9m@4ax.com>
Subject: Re: [PATCH] Use short pathnames in $^X and @INC if the long form cannot be represented in the current codepage
From: Jan Dubois <jand@ActiveState.com>
Date: Wed, 03 Jan 2007 08:12:35 -0800
Message-ID: <orknp2pj17265modfosjkp2qtt4bdgtgjp@4ax.com>
p4raw-id: //depot/perl@29675
Diffstat (limited to 'win32/perlhost.h')
-rw-r--r-- | win32/perlhost.h | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/win32/perlhost.h b/win32/perlhost.h index 3860507be6..e042103719 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -2238,32 +2238,6 @@ CPerlHost::FreeLocalEnvironmentStrings(LPSTR lpStr) Safefree(lpStr); } -static char * -get_valid_filename(pTHX_ WCHAR *widename) -{ - char *name; - BOOL use_default = FALSE; - size_t widelen = wcslen(widename)+1; - int len = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, widename, widelen, - NULL, 0, NULL, NULL); - Newx(name, len, char); - WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, widename, widelen, - name, len, NULL, &use_default); - if (use_default) { - WCHAR *shortname; - DWORD shortlen = GetShortPathNameW(widename, NULL, 0); - Newx(shortname, shortlen, WCHAR); - shortlen = GetShortPathNameW(widename, shortname, shortlen)+1; - len = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, shortname, shortlen, - NULL, 0, NULL, NULL); - Renew(name, len, char); - WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, shortname, shortlen, - name, len, NULL, NULL); - Safefree(shortname); - } - return name; -} - char* CPerlHost::GetChildDir(void) { @@ -2271,15 +2245,8 @@ CPerlHost::GetChildDir(void) char* ptr; size_t length; - if (IsWin95()) { - Newx(ptr, MAX_PATH+1, char); - m_pvDir->GetCurrentDirectoryA(MAX_PATH+1, ptr); - } - else { - WCHAR path[MAX_PATH+1]; - m_pvDir->GetCurrentDirectoryW(MAX_PATH+1, path); - ptr = get_valid_filename(aTHX_ path); - } + Newx(ptr, MAX_PATH+1, char); + m_pvDir->GetCurrentDirectoryA(MAX_PATH+1, ptr); length = strlen(ptr); if (length > 3) { if ((ptr[length-1] == '\\') || (ptr[length-1] == '/')) |