#include <TreeWalkBackup.h>


Definition at line 31 of file TreeWalkBackup.h.
Public Member Functions | |
| TreeWalkBackup (const cmn_Path &a_stackStorage, df_Packer &a_packer) | |
Public Attributes | |
| log_CLASSID_m | |
Private Member Functions | |
| virtual void | CheckDir (ivd_GenInode_t a_ownInode, const cmn_Path &a_path) |
Private Attributes | |
| bool | m_abort |
| df_Packer * | m_packer |
Definition at line 54 of file TreeWalkBackup.cpp.
References m_packer.
00056 : 00057 cmn_TreeWalk(a_stackStorage, m_abort=false) 00058 { 00059 m_packer = &a_packer; 00060 } //============================================================================//
| void TreeWalkBackup::CheckDir | ( | ivd_GenInode_t | a_ownInode, | |
| const cmn_Path & | a_path | |||
| ) | [private, virtual] |
Definition at line 64 of file TreeWalkBackup.cpp.
References cmn_MultiByteToWString(), dbg_LOW, cmn_TreeWalk::DoWalk(), file, g_numBackupFiles, g_numBadFiles, g_relPath, g_sizeBackupFiles, ivd_BaseException::GetFriendly(), cmn_TreeWalk::GetLastVector(), ift_DIR, log_DBG_m, log_FUNC_m, fname_inode_t::m_name, m_packer, PackFile(), cmn_TreeWalk::SaveStack(), and cmn_File::StatF().
00064 { 00065 log_FUNC_m(CheckDir); 00066 00067 bool skip = false; 00068 File_t fInfo; 00069 ivd_FileInfo_t info; 00070 //DWORD fileAttr = 0; 00071 fname_inode_vec_t &a_nameIno_v = GetLastVector(); 00072 00073 while (!a_nameIno_v.empty()) { 00074 00075 fname_inode_t &f = a_nameIno_v.back(); 00076 00077 DWORD fileAttr=0; 00078 // check if System Volume Info & other system dir and skip them 00079 fileAttr = GetFileAttributes(cmn_MultiByteToWString((a_path+f.m_name).c_str()).c_str()); 00080 if (fileAttr == INVALID_FILE_ATTRIBUTES){ 00081 cerr << "Warning: Skiping " << a_path + f.m_name << endl; 00082 log_DBG_m(dbg_LOW, "Warning: Skiping " << a_path + f.m_name); 00083 skip = true; // skip it 00084 g_numBadFiles++; 00085 } 00086 else if (fileAttr & 00087 FILE_ATTRIBUTE_SYSTEM && 00088 fileAttr & 00089 FILE_ATTRIBUTE_DIRECTORY && 00090 fileAttr & 00091 FILE_ATTRIBUTE_HIDDEN) { 00092 cerr << "Warning: Skiping system folder " << a_path + f.m_name << endl; 00093 log_DBG_m(dbg_LOW, "Warning: Skiping system folder " << a_path + f.m_name); 00094 skip = true; // skip it 00095 } 00096 00097 if (!skip) { 00098 try { 00099 cmn_File file(a_path + f.m_name); 00100 file.StatF(info); 00101 } 00102 catch(ivd_Exception &ie){ 00103 cerr << "ERROR: cannot access file " << a_path + f.m_name 00104 << ": " << ie.GetFriendly() << endl; 00105 skip = true; // skip it 00106 g_numBadFiles++; 00107 } 00108 } 00109 00110 if (!skip) { 00111 00112 /* dummy parsing of relative name */ 00113 string fullPath = a_path + f.m_name; 00114 string parsedPath; 00115 parsedPath.reserve(255); 00116 UInt32_t j=0; 00117 for (UInt32_t i=0; i < fullPath.length(); i++) { 00118 if (g_relPath[i] != fullPath[i]) { 00119 parsedPath[j++] = fullPath[i]; 00120 } 00121 else { 00122 if (i>=g_relPath.length()) parsedPath[j++] = fullPath[i]; 00123 } 00124 } 00125 parsedPath[j] = '\0'; 00126 00127 // cerr << fullPath << endl; 00128 // cerr << g_relPath << " " << ParsedPath.data() << endl; 00129 00130 UInt64_t backupSize = 0; 00131 if (PackFile(g_relPath, (string)parsedPath.data(), backupSize, *m_packer)) { 00132 g_numBackupFiles++; 00133 g_sizeBackupFiles += backupSize; 00134 } 00135 00136 // dummy clearing of string 00137 for(int i=0; i<255; i++) { 00138 parsedPath[i] = '\0'; 00139 } 00140 00141 if (info.type == ift_DIR) 00142 { 00143 if (!DoWalk(a_path + f.m_name, info.idOnFS)) { 00144 // DoWalk was unable to cnage to this directory 00145 // so skip all other entries. 00146 return; 00147 }; 00148 } // info.type == ift_DIR 00149 } // !skip 00150 a_nameIno_v.pop_back(); 00151 skip = false; 00152 00153 } // !a_nameIno_v.empty() 00154 SaveStack(); 00155 }

bool TreeWalkBackup::m_abort [private] |
df_Packer* TreeWalkBackup::m_packer [private] |
1.5.6