⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaultname.cpp

📁 7-Zip 3.11的源码
💻 CPP
字号:
// DefaultName.cpp

#include "StdAfx.h"

#include "Windows/FileDir.h"

#include "Common/StringConvert.h"
#include "DefaultName.h"

const wchar_t *kEmptyFileAlias = L"[Content]";

using namespace NWindows;
using namespace NFile;
using namespace NDirectory;

UString GetDefaultName(const UString &fullFileName, 
    const UString &extension, const UString &addSubExtension)
{
  UString fileName;
  if (!GetOnlyName(fullFileName, fileName))
    throw 5011749;
  int extLength = extension.Length();
  int fileNameLength = fileName.Length();
  if (fileNameLength <= extLength + 1)
    return kEmptyFileAlias;
  int dotPos = fileNameLength - (extLength + 1);
  if (fileName[dotPos] != '.')
    return kEmptyFileAlias;
  if (extension.CollateNoCase(fileName.Mid(dotPos + 1)) == 0)
    return fileName.Left(dotPos) + addSubExtension;
  return kEmptyFileAlias;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -