Permalink
Browse files

Merge pull request #4403 from taxigps/unrarxlib

fixed UnrarXlib: can't extract file with non-english file name.
  • Loading branch information...
2 parents 41206e5 + 9ccdae7 commit 1df35f762b7da652cd4efc7f0ff7aaf76a31a36e @jmarshallnz jmarshallnz committed Mar 14, 2014
Showing with 20 additions and 5 deletions.
  1. +6 −1 lib/UnrarXLib/extract.cpp
  2. +14 −4 lib/UnrarXLib/file.cpp
@@ -614,7 +614,12 @@ bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,int HeaderSize
#endif
return(true);
}
- if (CUtil::CreateDirectoryEx(DestFileName))
+ char _name[NM];
+ if (WideName)
+ WideToUtf(DestFileNameW, _name, sizeof(_name));
+ else
+ strcpy(_name, DestFileName);
+ if (CUtil::CreateDirectoryEx(_name))
{
#ifndef GUI
mprintf(St(MCreatDir),DestFileName);
View
@@ -109,11 +109,16 @@ bool File::Open(const char *Name,const wchar *NameW,bool OpenShared,bool Update)
HandleType=FILE_HANDLENORMAL;
SkipClose=false;
bool success=hNewFile!=BAD_HANDLE;*/
+ char _name[NM];
+ if (NameW!=NULL)
+ WideToUtf(NameW, _name, sizeof(_name));
+ else
+ strcpy(_name, Name);
bool success;
if (Update)
- success = m_File.OpenForWrite(Name);
+ success = m_File.OpenForWrite(_name);
else
- success = m_File.Open(Name);
+ success = m_File.Open(_name);
if (success)
{
// hFile=hNewFile;
@@ -165,9 +170,14 @@ bool File::Create(const char *Name,const wchar *NameW)
#else
hFile=fopen(Name,CREATEBINARY);
#endif*/
- CStdString strPath = URIUtils::GetDirectory(Name);
+ char _name[NM];
+ if (NameW!=NULL)
+ WideToUtf(NameW, _name, sizeof(_name));
+ else
+ strcpy(_name, Name);
+ CStdString strPath = URIUtils::GetDirectory(_name);
CUtil::CreateDirectoryEx(strPath);
- m_File.OpenForWrite(Name,true);
+ m_File.OpenForWrite(_name,true);
NewFile=true;
HandleType=FILE_HANDLENORMAL;
SkipClose=false;

0 comments on commit 1df35f7

Please sign in to comment.