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