Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

TreeWalkBackup Class Reference
[G_new_group]

#include <TreeWalkBackup.h>

Inheritance diagram for TreeWalkBackup:
Inheritance graph
[legend]
Collaboration diagram for TreeWalkBackup:
Collaboration graph
[legend]

List of all members.

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_Packerm_packer

Detailed Description

Definition at line 45 of file TreeWalkBackup.h.


Constructor & Destructor Documentation

TreeWalkBackup::TreeWalkBackup ( const cmn_Path a_stackStorage,
df_Packer a_packer 
)

Definition at line 68 of file TreeWalkBackup.cpp.

References m_packer.

    :
    cmn_TreeWalk(a_stackStorage, m_abort=false)
{
    m_packer = &a_packer;
}


Member Function Documentation

void TreeWalkBackup::CheckDir ( ivd_GenInode_t  a_ownInode,
const cmn_Path a_path 
) [private, virtual]

Definition at line 78 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().

                                                                               {
    log_FUNC_m(CheckDir);
    
    bool            skip = false;
    File_t          fInfo;
    ivd_FileInfo_t  info;
    //DWORD           fileAttr = 0;
    fname_inode_vec_t &a_nameIno_v = GetLastVector();

    while (!a_nameIno_v.empty()) {

        fname_inode_t &f = a_nameIno_v.back();

        DWORD fileAttr=0;
        // check if System Volume Info & other system dir and skip them
        fileAttr = GetFileAttributes(cmn_MultiByteToWString((a_path+f.m_name).c_str()).c_str());
        if (fileAttr == INVALID_FILE_ATTRIBUTES){
            cerr << "Warning: Skiping " << a_path + f.m_name << endl;
            log_DBG_m(dbg_LOW, "Warning: Skiping " << a_path + f.m_name);
            skip = true; // skip it
            g_numBadFiles++;
        }
        else if (fileAttr &
            FILE_ATTRIBUTE_SYSTEM  &&
            fileAttr &
            FILE_ATTRIBUTE_DIRECTORY &&
            fileAttr &
            FILE_ATTRIBUTE_HIDDEN) {
            cerr << "Warning: Skiping system folder " << a_path + f.m_name << endl;
            log_DBG_m(dbg_LOW, "Warning: Skiping system folder " << a_path + f.m_name);
            skip = true; // skip it
        }

        if (!skip) { 
            try {
                cmn_File file(a_path + f.m_name);
                file.StatF(info);
            }
            catch(ivd_Exception &ie){
                cerr << "ERROR: cannot access file " << a_path + f.m_name
                    << ": " << ie.GetFriendly() << endl;
                skip = true; // skip it
                g_numBadFiles++;
            }
        }

        if (!skip) {

            /* dummy parsing of relative name */
            string fullPath = a_path + f.m_name;
            string parsedPath;
            parsedPath.reserve(255);
            UInt32_t j=0;
            for (UInt32_t i=0; i < fullPath.length(); i++) {
                if (g_relPath[i] != fullPath[i]) {
                    parsedPath[j++] = fullPath[i];
                }
                else {
                    if (i>=g_relPath.length()) parsedPath[j++] = fullPath[i];
                }
            }
            parsedPath[j] = '\0';

//       cerr << fullPath << endl;
//       cerr << g_relPath << "  " << ParsedPath.data() << endl;

            UInt64_t backupSize = 0;
            if (PackFile(g_relPath, (string)parsedPath.data(), backupSize, *m_packer)) {
                g_numBackupFiles++;
                g_sizeBackupFiles += backupSize;
            }
       
            // dummy clearing of string
            for(int i=0; i<255; i++) {
                parsedPath[i] = '\0';
            }

            if (info.type == ift_DIR)
            {
                if (!DoWalk(a_path + f.m_name, info.idOnFS)) {
                    // DoWalk was unable to cnage to this directory
                    // so skip all other entries. 
                    return;
                };
            } // info.type == ift_DIR
        } // !skip
        a_nameIno_v.pop_back();
        skip = false;

    } // !a_nameIno_v.empty()
    SaveStack();
}

Here is the call graph for this function:


Member Data Documentation

Reimplemented from cmn_TreeWalk.

Definition at line 52 of file TreeWalkBackup.h.

bool TreeWalkBackup::m_abort [private]

Reimplemented from cmn_TreeWalk.

Definition at line 55 of file TreeWalkBackup.h.

Definition at line 56 of file TreeWalkBackup.h.

Referenced by CheckDir(), and TreeWalkBackup().


The documentation for this class was generated from the following files: