本文整理汇总了C++中Path::RemoveExtension方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::RemoveExtension方法的具体用法?C++ Path::RemoveExtension怎么用?C++ Path::RemoveExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::RemoveExtension方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnOpenTemplate
/// <summary>Opens a document template.</summary>
/// <param name="docPath">document path.</param>
/// <param name="t">template.</param>
/// <returns></returns>
BOOL ScriptDocument::OnOpenTemplate(Path docPath, const TemplateFile& t)
{
WorkerData data(Operation::LoadSaveDocument);
try
{
// Feedback
Console << Cons::UserAction << "Creating script: " << docPath << " from template: " << Path(t.SubPath) << ENDL;
data.SendFeedback(ProgressType::Operation, 0, VString(L"Creating %s '%s'", t.Name.c_str(), docPath.c_str()));
// Read/Parse template script
AppPath path(t.SubPath);
Script = ScriptFileReader(XFileInfo(path).OpenRead()).ReadFile(path, false);
// Set properties
Script.Name = docPath.RemoveExtension().FileName;
Script.Game = PrefsLib.GameDataVersion;
Script.Version = 1;
Script.Description = L"no description";
// Populate template
LineArray lines;
wstring date = COleDateTime(time(nullptr)).Format(L"%d/%m/%Y");
for (auto& cmd : Script.Commands.Input)
{
cmd.Text = cmd.Text.ReplaceAll(L"$NAME$", Script.Name);
cmd.Text = cmd.Text.ReplaceAll(L"$DATE$", date);
cmd.Text = cmd.Text.ReplaceAll(L"$AUTHOR$", L"");
lines.push_back(cmd.Text);
}
// Create temp scriptFile
ScriptFile tmp(Script);
tmp.FullPath = docPath;
// Compile changes into temporary script
ScriptParser parser(tmp, lines, Script.Game);
parser.Compile();
// Write to disc
ScriptFileWriter w(XFileInfo(docPath).OpenWrite());
w.Write(tmp);
w.Close();
// Feedback
data.SendFeedback(Cons::Success, ProgressType::Succcess, 0, L"Script created successfully");
return TRUE;
}
catch (ExceptionBase& e)
{
// Feedback/Display error
data.SendFeedback(Cons::Error, ProgressType::Failure, 0, VString(L"Failed to create %s '%s'", t.Name.c_str(), docPath.c_str()));
theApp.ShowError(HERE, e, VString(L"Failed to create %s '%s'", t.Name.c_str(), docPath.c_str()));
return FALSE;
}
}
示例2: Matches
/// <summary>Compares descriptor against the specified path.</summary>
/// <param name="path">The path to compare against</param>
/// <param name="checkExtension">Whether the file extension must also match</param>
/// <returns></returns>
bool XFileInfo::Matches(Path path, bool checkExtension) const
{
return checkExtension ? FullPath == path : Key == path.RemoveExtension();
}