-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
MemStick.h
37 lines (29 loc) · 836 Bytes
/
MemStick.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once
#include "Common/File/Path.h"
#include <mutex>
#include <string_view>
// Utility functions moved out from MemstickScreen.
class MoveProgressReporter {
public:
void SetProgress(std::string_view value, size_t count = 0, size_t maxVal = 0) {
std::lock_guard<std::mutex> guard(mutex_);
progress_ = value;
count_ = (int)count;
max_ = (int)maxVal;
}
std::string Format();
private:
std::string progress_;
std::mutex mutex_;
int count_;
int max_;
};
struct MoveResult {
bool success; // Got through the whole move.
std::string errorMessage;
size_t failedFiles;
size_t skippedFiles;
};
bool FolderSeemsToBeUsed(const Path &newMemstickFolder);
bool SwitchMemstickFolderTo(Path newMemstickFolder);
MoveResult *MoveDirectoryContentsSafe(Path moveSrc, Path moveDest, MoveProgressReporter &progressReporter);