#136: Unicode-Windows-API for file operations

- internally all paths are handled in UTF8;
- all paths are stored in config-file in UTF8;
- when calling file access Windows API functions the paths are
converted to wide-chars and Unicode-API is used;
- extra long paths are prefixed with “\\?\” (extended path format).
This commit is contained in:
Andrey Prygunkov
2015-12-28 10:56:11 +01:00
parent c68ba306fe
commit e11dfb62d0
5 changed files with 210 additions and 123 deletions

View File

@@ -478,14 +478,7 @@ bool Scanner::AddFileToQueue(const char* filename, const char* nzbName, const ch
if (nzbName && strlen(nzbName) > 0)
{
nzbInfo->SetName(NULL);
#ifdef WIN32
char* ansiFilename = strdup(nzbName);
WebUtil::Utf8ToAnsi(ansiFilename, strlen(ansiFilename) + 1);
nzbInfo->SetFilename(ansiFilename);
free(ansiFilename);
#else
nzbInfo->SetFilename(nzbName);
#endif
nzbInfo->BuildDestDirName();
}
@@ -583,10 +576,6 @@ Scanner::EAddStatus Scanner::AddExternalFile(const char* nzbName, const char* ca
BString<1024> validNzbName = FileSystem::BaseFileName(nzbName);
FileSystem::MakeValidFilename(validNzbName, '_', false);
#ifdef WIN32
WebUtil::Utf8ToAnsi(validNzbName, validNzbName.Capacity());
#endif
const char* extension = strrchr(nzbName, '.');
if (nzb && (!extension || strcasecmp(extension, ".nzb")))
{