From 35596517f203f1c4970413b3b5b2e216b849e462 Mon Sep 17 00:00:00 2001 From: Igor Pavlov Date: Mon, 11 Apr 2011 00:00:00 +0000 Subject: 9.21 --- CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp | 39 ++++++++++++++++++------ 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp') diff --git a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp index 08f15c18..d29ac44c 100755 --- a/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp +++ b/CPP/7zip/UI/FileManager/FileFolderPluginOpen.cpp @@ -4,6 +4,7 @@ #include "resource.h" +#include "Windows/FileName.h" #include "Windows/Thread.h" #include "../Agent/Agent.h" @@ -11,11 +12,9 @@ #include "LangUtils.h" #include "OpenCallback.h" #include "PluginLoader.h" -#include "RegistryAssociations.h" #include "RegistryPlugins.h" using namespace NWindows; -using namespace NRegistryAssociations; struct CThreadArchiveOpen { @@ -56,9 +55,29 @@ static int FindPlugin(const CObjectVector &plugins, const UString & } */ +static const FChar kExtensionDelimiter = FTEXT('.'); + +static void SplitNameToPureNameAndExtension(const FString &fullName, + FString &pureName, FString &extensionDelimiter, FString &extension) +{ + int index = fullName.ReverseFind(kExtensionDelimiter); + if (index < 0) + { + pureName = fullName; + extensionDelimiter.Empty(); + extension.Empty(); + } + else + { + pureName = fullName.Left(index); + extensionDelimiter = kExtensionDelimiter; + extension = fullName.Mid(index + 1); + } +} + HRESULT OpenFileFolderPlugin( IInStream *inStream, - const UString &path, + const FString &path, const UString &arcFormat, HMODULE *module, IFolderFolder **resultFolder, @@ -68,11 +87,11 @@ HRESULT OpenFileFolderPlugin( CObjectVector plugins; ReadFileFolderPluginInfoList(plugins); - UString extension, name, pureName, dot; + FString extension, name, pureName, dot; - int slashPos = path.ReverseFind(WCHAR_PATH_SEPARATOR); - UString dirPrefix; - UString fileName; + int slashPos = path.ReverseFind(FCHAR_PATH_SEPARATOR); + FString dirPrefix; + FString fileName; if (slashPos >= 0) { dirPrefix = path.Left(slashPos + 1); @@ -81,7 +100,7 @@ HRESULT OpenFileFolderPlugin( else fileName = path; - NFile::NName::SplitNameToPureNameAndExtension(fileName, pureName, dot, extension); + SplitNameToPureNameAndExtension(fileName, pureName, dot, extension); /* if (!extension.IsEmpty()) @@ -124,12 +143,12 @@ HRESULT OpenFileFolderPlugin( t.OpenCallbackSpec->ParentWindow = parentWindow; if (inStream) - t.OpenCallbackSpec->SetSubArchiveName(fileName); + t.OpenCallbackSpec->SetSubArchiveName(fs2us(fileName)); else t.OpenCallbackSpec->LoadFileInfo(dirPrefix, fileName); t.InStream = inStream; - t.Path = path; + t.Path = fs2us(path); t.ArcFormat = arcFormat; UString progressTitle = LangString(IDS_OPENNING, 0x03020283); -- cgit v1.2.3