本文整理汇总了C++中TextFile::SetTo方法的典型用法代码示例。如果您正苦于以下问题:C++ TextFile::SetTo方法的具体用法?C++ TextFile::SetTo怎么用?C++ TextFile::SetTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextFile
的用法示例。
在下文中一共展示了TextFile::SetTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: appDir
void
EnsureTemplates(void)
{
// Because creating a new project depends on the existence of the Templates folder,
// make sure that we have some (very) basic templates to work with if the folder
// has been deleted.
DPath templatePath = gAppPath.GetFolder();
templatePath << "Templates";
bool missing = false;
BDirectory tempDir;
if (!BEntry(templatePath.GetFullPath()).Exists())
{
BDirectory appDir(gAppPath.GetFolder());
appDir.CreateDirectory("Templates", &tempDir);
missing = true;
}
else
{
tempDir.SetTo(templatePath.GetFullPath());
if (tempDir.CountEntries() == 0)
missing = true;
}
if (missing)
{
BDirectory dir;
tempDir.CreateDirectory("Empty Application", &dir);
tempDir.CreateDirectory("Kernel Driver", &dir);
tempDir.CreateDirectory("Shared Library or Addon", &dir);
tempDir.CreateDirectory("Static Library", &dir);
DPath filePath;
TextFile file;
filePath = templatePath;
filePath << "Empty Application/TEMPLATEINFO";
file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE);
file.WriteString("TYPE=Application\nLIB=B_BEOS_LIB_DIRECTORY/libsupc++.so\n");
filePath = templatePath;
filePath << "Kernel Driver/TEMPLATEINFO";
file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE);
file.WriteString("TYPE=Driver\n");
filePath = templatePath;
filePath << "Shared Library or Addon/TEMPLATEINFO";
file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE);
file.WriteString("TYPE=Shared\n");
filePath = templatePath;
filePath << "Static Library/TEMPLATEINFO";
file.SetTo(filePath.GetFullPath(), B_CREATE_FILE | B_READ_WRITE);
file.WriteString("TYPE=Static\n");
file.Unset();
}
}