MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / ExtractRes

Method ExtractRes

LuaSTGPlus/ResourceMgr.cpp:1731–1769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1729}
1730
1731bool ResourceMgr::ExtractRes(const wchar_t* path, const wchar_t* target)LNOEXCEPT
1732{
1733 fcyRefPointer<fcyMemStream> tBuf;
1734
1735 // ��ȡ�ļ�
1736 if (LoadFile(path, tBuf))
1737 {
1738 // �򿪱����ļ�
1739 fcyRefPointer<fcyFileStream> pFile;
1740 try
1741 {
1742 pFile.DirectSet(new fcyFileStream(target, true));
1743 if (FCYFAILED(pFile->SetLength(0)))
1744 {
1745 LERROR("ResourceMgr: �޷�����ļ�'%s' (fcyFileStream::SetLength ʧ��)", target);
1746 return false;
1747 }
1748 if (tBuf->GetLength() > 0)
1749 {
1750 if (FCYFAILED(pFile->WriteBytes((fcData)tBuf->GetInternalBuffer(), tBuf->GetLength(), nullptr)))
1751 {
1752 LERROR("ResourceMgr: �޷����ļ�'%s'д������", target);
1753 return false;
1754 }
1755 }
1756 }
1757 catch (const bad_alloc&)
1758 {
1759 LERROR("ResourceMgr: �޷������㹻�ڴ������ļ�'%s'д������", target);
1760 return false;
1761 }
1762 catch (const fcyException& e)
1763 {
1764 LERROR("ResourceMgr: �򿪱����ļ�'%s'ʧ�� (�쳣��Ϣ'%m' Դ'%m')", target, e.GetDesc(), e.GetSrc());
1765 return false;
1766 }
1767 }
1768 return true;
1769}
1770
1771LNOINLINE bool ResourceMgr::ExtractRes(const char* path, const char* target)LNOEXCEPT
1772{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected