| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | hzFileset::Export | (const char*,) |
Declared in file: hzDirectory.h
Defined in file : hzDirectory.cpp
Function Logic:
Function body:
hzEcode hzFileset::Export (const char* filepath)
{
_hzfunc("hzFileset::Export()") ;
hzList<hzDirent*>::Iter I ;
std::ofstream os ;
hzChain Z ;
hzDirent* pDX ;
hzDirent* pFX ;
uint32_t totSize = 0;
uint32_t nD ;
uint32_t nF ;
uint32_t fileLo ;
uint32_t fileHi ;
char cvLine [512];
if (!filepath || !filepath[0])
return E_ARGUMENT ;
os.open(filepath) ;
if (os.fail())
return E_OPENFAIL ;
Z.Printf("# Export: %s Directories\n", FormalNumber(m_dirs.Count(),0));
Z.Printf("# Export: %s Files\n", FormalNumber(m_file.Count(),0));
os << Z ;
if (os.fail())
return E_WRITEFAIL ;
for (nD = 0; nD < m_dirs.Count() ; nD++)
{
pDX = m_dirs.GetObj(nD) ;
sprintf(cvLine, "D %010d %08x %010u %010u %010u %05d %05d %s\n",
pDX->Inode(), pDX->Mode(), pDX->Size(), pDX->Ctime(), pDX->Mtime(), pDX->Owner(), pDX->Group(), pDX->txtName()) ;
os << cvLine ;
fileLo = m_file.First(pDX->strName()) ;
if (fileLo < 0)
continue ;
fileHi = m_file.Last(pDX->strName()) ;
for (nF = fileLo ; nF <&eq; fileHi ; nF++)
{
pFX = m_file.GetObj(nF) ;
if (pFX->IsDir())
continue ;
totSize += pFX->Size() ;
sprintf(cvLine, "F %010d %08x %010u %010u %010u %05d %05d %s\n",
pFX->Inode(), pFX->Mode(), pFX->Size(), pFX->Ctime(), pFX->Mtime(), pFX->Owner(), pFX->Group(), pFX->txtName()) ;
os << cvLine ;
}
}
if (os.fail())
return E_WRITEFAIL ;
os << "# Export Complete - total " << FormalNumber(totSize,0)<< " bytes\n" ;
os.close() ;
return E_OK ;
}