80 lines
1.6 KiB
C++
Executable File
80 lines
1.6 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2010, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#ifndef headerfile_winix_functions_cp
|
|
#define headerfile_winix_functions_cp
|
|
|
|
#include "functionbase.h"
|
|
|
|
|
|
|
|
namespace Fun
|
|
{
|
|
|
|
|
|
|
|
class Cp : public FunctionBase
|
|
{
|
|
public:
|
|
|
|
Cp();
|
|
bool HasAccess();
|
|
void MakePost();
|
|
|
|
private:
|
|
|
|
Item temp;
|
|
DbItemQuery iq;
|
|
bool remove_defaults;
|
|
bool preserve_attr;
|
|
bool follow_symlinks;
|
|
long new_user;
|
|
long new_group;
|
|
|
|
// destination dir (will not be empty)
|
|
std::vector<Item*> dir_tab, symlink_dir_tab;
|
|
|
|
// for testing loops in directories (between symlinks)
|
|
std::vector<long> loop_checker;
|
|
|
|
// destination file (if exists)
|
|
std::wstring file;
|
|
|
|
// for copying static files
|
|
std::wstring new_path, new_path_thumb;
|
|
std::wstring old_path, old_path_thumb;
|
|
|
|
std::vector<Item> item_tab;
|
|
|
|
bool WasThisDir(const Item & dir);
|
|
bool CheckAccessFrom();
|
|
bool CheckAccessTo();
|
|
bool ParseDir();
|
|
bool CopyStaticFile(const std::wstring & from, const std::wstring & to);
|
|
void CopyStaticFile(Item & item);
|
|
void SetNewAttributes(Item & item);
|
|
void CopyFile(Item & item, long dst_dir_id);
|
|
void CopyFileOrSymlink(Item & item, long dst_dir_id);
|
|
void Prepare();
|
|
void CopyFilesInDir(const Item & dir, long dst_dir_id);
|
|
void CopyDirContentTree(const Item & item, long dst_dir_id);
|
|
long CopyDirTree(const Item & item, long dst_dir_id);
|
|
bool IsTheSameFile(const Item & item);
|
|
void Clear();
|
|
void PostCopyFile(Item & item, bool redirect = true);
|
|
void PostCopyDirContent(const Item & dir, bool redirect = true);
|
|
void PostCopyDir(const Item & dir, bool redirect = true);
|
|
|
|
};
|
|
|
|
|
|
} // namespace
|
|
|
|
#endif
|