1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync// Windows/FileName.cpp 2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 3baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "StdAfx.h" 4baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 5baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "Windows/FileName.h" 6baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "Common/Wildcard.h" 7baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 8baa3858d3f5d128a5c8466b700098109edcad5f2repo syncnamespace NWindows { 9baa3858d3f5d128a5c8466b700098109edcad5f2repo syncnamespace NFile { 10baa3858d3f5d128a5c8466b700098109edcad5f2repo syncnamespace NName { 11baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 12baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid NormalizeDirPathPrefix(CSysString &dirPath) 13baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 14baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (dirPath.IsEmpty()) 15baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return; 16baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (dirPath.ReverseFind(kDirDelimiter) != dirPath.Length() - 1) 17baa3858d3f5d128a5c8466b700098109edcad5f2repo sync dirPath += kDirDelimiter; 18baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} 19baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 20baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifndef _UNICODE 21baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid NormalizeDirPathPrefix(UString &dirPath) 22baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 23baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (dirPath.IsEmpty()) 24baa3858d3f5d128a5c8466b700098109edcad5f2repo sync return; 25baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (dirPath.ReverseFind(wchar_t(kDirDelimiter)) != dirPath.Length() - 1) 26baa3858d3f5d128a5c8466b700098109edcad5f2repo sync dirPath += wchar_t(kDirDelimiter); 27baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} 28baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif 29baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 30baa3858d3f5d128a5c8466b700098109edcad5f2repo syncconst wchar_t kExtensionDelimiter = L'.'; 31baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 32baa3858d3f5d128a5c8466b700098109edcad5f2repo syncvoid SplitNameToPureNameAndExtension(const UString &fullName, 33baa3858d3f5d128a5c8466b700098109edcad5f2repo sync UString &pureName, UString &extensionDelimiter, UString &extension) 34baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{ 35baa3858d3f5d128a5c8466b700098109edcad5f2repo sync int index = fullName.ReverseFind(kExtensionDelimiter); 36baa3858d3f5d128a5c8466b700098109edcad5f2repo sync if (index < 0) 37baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 38baa3858d3f5d128a5c8466b700098109edcad5f2repo sync pureName = fullName; 39baa3858d3f5d128a5c8466b700098109edcad5f2repo sync extensionDelimiter.Empty(); 40baa3858d3f5d128a5c8466b700098109edcad5f2repo sync extension.Empty(); 41baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 42baa3858d3f5d128a5c8466b700098109edcad5f2repo sync else 43baa3858d3f5d128a5c8466b700098109edcad5f2repo sync { 44baa3858d3f5d128a5c8466b700098109edcad5f2repo sync pureName = fullName.Left(index); 45baa3858d3f5d128a5c8466b700098109edcad5f2repo sync extensionDelimiter = kExtensionDelimiter; 46baa3858d3f5d128a5c8466b700098109edcad5f2repo sync extension = fullName.Mid(index + 1); 47baa3858d3f5d128a5c8466b700098109edcad5f2repo sync } 48baa3858d3f5d128a5c8466b700098109edcad5f2repo sync} 49baa3858d3f5d128a5c8466b700098109edcad5f2repo sync 50baa3858d3f5d128a5c8466b700098109edcad5f2repo sync}}} 51