mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-03 14:32:24 +02:00
* Rework PR #373 to reduce needless logging in monitor mode
This commit is contained in:
parent
442e3dee16
commit
51615bff0b
16
src/main.d
16
src/main.d
|
@ -480,7 +480,7 @@ int main(string[] args)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform the sync
|
// Perform the sync
|
||||||
performSync(sync, singleDirectory, downloadOnly, localFirst, uploadOnly);
|
performSync(sync, singleDirectory, downloadOnly, localFirst, uploadOnly, monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ int main(string[] args)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
performSync(sync, singleDirectory, downloadOnly, localFirst, uploadOnly);
|
performSync(sync, singleDirectory, downloadOnly, localFirst, uploadOnly, monitor);
|
||||||
if (!downloadOnly) {
|
if (!downloadOnly) {
|
||||||
// discard all events that may have been generated by the sync
|
// discard all events that may have been generated by the sync
|
||||||
m.update(false);
|
m.update(false);
|
||||||
|
@ -597,7 +597,7 @@ bool initSyncEngine(SyncEngine sync)
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to synchronize the folder three times
|
// try to synchronize the folder three times
|
||||||
void performSync(SyncEngine sync, string singleDirectory, bool downloadOnly, bool localFirst, bool uploadOnly)
|
void performSync(SyncEngine sync, string singleDirectory, bool downloadOnly, bool localFirst, bool uploadOnly, bool monitor)
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
string remotePath = "/";
|
string remotePath = "/";
|
||||||
|
@ -617,18 +617,18 @@ void performSync(SyncEngine sync, string singleDirectory, bool downloadOnly, boo
|
||||||
log.vlog("Syncing changes from this selected path: ", singleDirectory);
|
log.vlog("Syncing changes from this selected path: ", singleDirectory);
|
||||||
if (uploadOnly){
|
if (uploadOnly){
|
||||||
// Upload Only of selected single directory
|
// Upload Only of selected single directory
|
||||||
log.log("Syncing changes from selected local path only - NOT syncing data changes from OneDrive ...");
|
if (!monitor) log.log("Syncing changes from selected local path only - NOT syncing data changes from OneDrive ...");
|
||||||
sync.scanForDifferences(localPath);
|
sync.scanForDifferences(localPath);
|
||||||
} else {
|
} else {
|
||||||
// No upload only
|
// No upload only
|
||||||
if (localFirst) {
|
if (localFirst) {
|
||||||
// Local First
|
// Local First
|
||||||
log.log("Syncing changes from selected local path first before downloading changes from OneDrive ...");
|
if (!monitor) log.log("Syncing changes from selected local path first before downloading changes from OneDrive ...");
|
||||||
sync.scanForDifferences(localPath);
|
sync.scanForDifferences(localPath);
|
||||||
sync.applyDifferencesSingleDirectory(remotePath);
|
sync.applyDifferencesSingleDirectory(remotePath);
|
||||||
} else {
|
} else {
|
||||||
// OneDrive First
|
// OneDrive First
|
||||||
log.log("Syncing changes from selected OneDrive path ...");
|
if (!monitor) log.log("Syncing changes from selected OneDrive path ...");
|
||||||
sync.applyDifferencesSingleDirectory(remotePath);
|
sync.applyDifferencesSingleDirectory(remotePath);
|
||||||
// is this a download only request?
|
// is this a download only request?
|
||||||
if (!downloadOnly) {
|
if (!downloadOnly) {
|
||||||
|
@ -643,13 +643,13 @@ void performSync(SyncEngine sync, string singleDirectory, bool downloadOnly, boo
|
||||||
// no single directory sync
|
// no single directory sync
|
||||||
if (uploadOnly){
|
if (uploadOnly){
|
||||||
// Upload Only of entire sync_dir
|
// Upload Only of entire sync_dir
|
||||||
log.log("Syncing changes from local path only - NOT syncing data changes from OneDrive ...");
|
if (!monitor) log.log("Syncing changes from local path only - NOT syncing data changes from OneDrive ...");
|
||||||
sync.scanForDifferences(localPath);
|
sync.scanForDifferences(localPath);
|
||||||
} else {
|
} else {
|
||||||
// No upload only
|
// No upload only
|
||||||
if (localFirst) {
|
if (localFirst) {
|
||||||
// sync local files first before downloading from OneDrive
|
// sync local files first before downloading from OneDrive
|
||||||
log.log("Syncing changes from local path first before downloading changes from OneDrive ...");
|
if (!monitor) log.log("Syncing changes from local path first before downloading changes from OneDrive ...");
|
||||||
sync.scanForDifferences(localPath);
|
sync.scanForDifferences(localPath);
|
||||||
sync.applyDifferences();
|
sync.applyDifferences();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue