Skip to content

Commit

Permalink
Merge pull request #9 from IT-Students-Web-Project/Voxislav
Browse files Browse the repository at this point in the history
Voxislav
  • Loading branch information
Voxislav authored Feb 3, 2021
2 parents 35ea792 + e1081bc commit 192c538
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
9 changes: 2 additions & 7 deletions AutoBackup/TaskExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ DWORD WINAPI MyThreadFunction(LPVOID lpParam);
//Struktura danych do przekazywania parametrów do w¹tków
typedef struct threadData
{
string srcDir;
string destDir;
char* srcDir;
char* destDir;
bool compress = false;
}MYDATA, * PMYDATA;
//Przekazywanie przez pusty wskaŸnik LPVOID, mo¿na stosowaæ dowolny typ danych
Expand Down Expand Up @@ -139,11 +139,8 @@ void TaskExecutor::DoBackup(string source, string destination, bool compress)
source.pop_back();
WIN32_FIND_DATAA findFileData;
HANDLE findHandle = FindFirstFile(source.c_str(), &findFileData);
cout << "Source: " << source << endl;
cout << "Error: " << GetLastError() << endl;
if (findHandle != INVALID_HANDLE_VALUE)
{
cout << "Attr: " << findFileData.dwFileAttributes << endl;
bool success = false;

if (findFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
Expand All @@ -153,11 +150,9 @@ void TaskExecutor::DoBackup(string source, string destination, bool compress)
source += "\\";
source += "*.*";
source.append(1, '\0');
cout << "Source append: " << source << endl;
if (destination.back() != '\\')
destination += "\\";
destination.append(1, '\0');
//std::cout << source << " " << destination << endl;
SHFILEOPSTRUCT shFileOperationStructure = { 0 };
shFileOperationStructure.wFunc = FO_COPY;
shFileOperationStructure.fFlags = FOF_SILENT;
Expand Down
Empty file removed AutoBackup/schedule.dat
Empty file.
4 changes: 2 additions & 2 deletions AutoBackupConsole/Dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Command Dialog::showMainDialog()
case Command::Stop: stopAutoBackupProcess(); break;
case Command::ShowSchedule: showSchedule(); break;
case Command::NewTask: createNewBackupTask(); break;
case Command::ClearTasks: clearTasks(); break;
case Command::ClearTasks: clearTasks(); break; //Usuwa wpisy do harmonogramu
case Command::Shutdown: break;
}
return command;
Expand Down Expand Up @@ -161,7 +161,7 @@ void Dialog::saveTask(const BackupProperties& backup)
ofs.close();
}

void Dialog::clearTasks()
void Dialog::clearTasks() //Funkcja nadpisuje plik z harmonogramem w celu usuniêcia zaplanowanych zadañ
{
std::ofstream ofs;
ofs.open("schedule.dat", std::ofstream::out | std::ofstream::trunc);
Expand Down
1 change: 1 addition & 0 deletions AutoBackupConsole/schedule.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
03-02-2021 16:00:00 00 00:01 C:\test C:\test_bak 0

0 comments on commit 192c538

Please sign in to comment.