//copyf - copy file or folder with content #ifndef INCLUDE_COPYF_H #define INCLUDE_COPYF_H #print "[include ]\n" #ifndef INCLUDE_FILESYSTEM_H #include "../lib/file_system.h" #endif :int copyf(dword from1, in1) { dword error; BDVK CopyFile_atr1; if (!from1) || (!in1) { notify("Error: too less copyf params!"); notify(from1); notify(in1); return; } if (error = GetFileInfo(from1, #CopyFile_atr1)) { debugln("Error: copyf->GetFileInfo"); return error; } if (dir_exists(from1)) return CopyFolder(from1, in1); else { Operation_Draw_Progress(from1+strchr(from1, '/')); return CopyFile(from1, in1); } } :int CopyFile(dword copy_from3, copy_in3) { BDVK CopyFile_atr; dword error, cbuf; if (error = GetFileInfo(copy_from3, #CopyFile_atr)) { debugln("Error: CopyFile->GetFileInfo"); } else if (GetFreeRAM() < CopyFile_atr.sizelo) { debugln("Error: CopyFile->File size is bigger than RAM avilable"); error = 30; } else { cbuf = malloc(CopyFile_atr.sizelo); if (error = ReadFile(0, CopyFile_atr.sizelo, cbuf, copy_from3)) { debugln("Error: CopyFile->ReadFile"); } else { if (error = WriteFile(CopyFile_atr.sizelo, cbuf, copy_in3)) debugln("Error: CopyFile->WriteFile"); } } free(cbuf); if (error) debug_error(copy_from3, error); return error; } :int CopyFolder(dword from2, in2) { dword dirbuf, fcount, i, filename; char copy_from2[4096], copy_in2[4096], error; if (error = GetDir(#dirbuf, #fcount, from2, DIRS_ONLYREAL)) { debugln("Error: CopyFolder->GetDir"); debug_error(from2, error); free(dirbuf); return error; } if (chrnum(in2, '/')>2) && (error = CreateDir(in2)) { debugln("Error: CopyFolder->CreateDir"); debug_error(in2, error); free(dirbuf); return error; } for (i=0; i