本文整理汇总了C++中VirtualDrive::FileOpen方法的典型用法代码示例。如果您正苦于以下问题:C++ VirtualDrive::FileOpen方法的具体用法?C++ VirtualDrive::FileOpen怎么用?C++ VirtualDrive::FileOpen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtualDrive
的用法示例。
在下文中一共展示了VirtualDrive::FileOpen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Open
BOOL VirtualFile::Open(LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* /*pError*/)
{
// Open() only works if a VirtualDriveManager is present.
VirtualDriveManager* manager = VirtualDriveManager::GetInstance();
if (!manager)
{
ASSERT(0);
return FALSE;
}
m_strFileName = lpszFileName;
// Parse the incoming filename.
CString virtualDriveName;
CString virtualFileName;
manager->ParseFilename(lpszFileName, virtualDriveName, virtualFileName);
VirtualDrive* drive = manager->Open(virtualDriveName, false);
if (!drive)
return FALSE;
if (nOpenFlags & modeCreate)
{
if (drive->m_readOnly)
return false;
return drive->FileCreate(virtualFileName, *this);
}
return drive->FileOpen(virtualFileName, *this);
}
示例2: LS_VirtualDrive_FileOpen
int LS_VirtualDrive_FileOpen(LuaState* state, LuaStackObject* args)
{
VirtualDrive* drive = VirtualDriveFromLua(state, args[1]);
const char* fileName = NULL;
int entryIndex = -1;
if (args[2].IsString())
fileName = args[2].GetString();
else if (args[2].IsNumber())
entryIndex = args[2].GetInteger();
else
luaL_error(*state, "Argument 2 is not a string or integer.");
VirtualFileHandle* file = PushVirtualFileHandleObj(state);
if (fileName)
{
if (!drive->FileOpen(fileName, *file))
return 0;
}
else
{
if (!drive->FileOpenIndex((size_t)entryIndex, *file))
return 0;
}
return 1;
}