mirror of
https://github.com/abraunegg/onedrive
synced 2024-05-10 17:56:44 +02:00
Merge pull request #28 from abraunegg/Issue-#8
Implement feature request: Detect when sync-folder is missing
This commit is contained in:
commit
63c5dd86b7
|
@ -249,6 +249,7 @@ If you encounter any bugs you can report them here on Github. Before filing an i
|
|||
Usage: onedrive [OPTION]...
|
||||
|
||||
no option No Sync and exit
|
||||
--check-for-nomount Check for the presence of .nosync in the syncdir root. If found, do not perform sync.
|
||||
--confdir Set the directory used to store the configuration files
|
||||
--create-directory Create a directory on OneDrive - no sync will be performed.
|
||||
--destination-directory Destination directory for renamed or move on OneDrive - no sync will be performed.
|
||||
|
|
15
src/main.d
15
src/main.d
|
@ -56,12 +56,15 @@ int main(string[] args)
|
|||
bool localFirst;
|
||||
// Upload Only
|
||||
bool uploadOnly;
|
||||
// Add a check mounts option to resolve https://github.com/abraunegg/onedrive/issues/8
|
||||
bool checkMount;
|
||||
|
||||
try {
|
||||
auto opt = getopt(
|
||||
args,
|
||||
std.getopt.config.bundling,
|
||||
std.getopt.config.caseSensitive,
|
||||
"check-for-nomount", "Check for the presence of .nosync in the syncdir root. If found, do not perform sync.", &checkMount,
|
||||
"confdir", "Set the directory used to store the configuration files", &configDirName,
|
||||
"create-directory", "Create a directory on OneDrive - no sync will be performed.", &createDirectory,
|
||||
"destination-directory", "Destination directory for renamed or move on OneDrive - no sync will be performed.", &destinationDirectory,
|
||||
|
@ -190,7 +193,17 @@ int main(string[] args)
|
|||
log.log("Initializing the Synchronization Engine ...");
|
||||
auto sync = new SyncEngine(cfg, onedrive, itemdb, selectiveSync);
|
||||
sync.init();
|
||||
|
||||
|
||||
// Do we need to validate the syncDir to check for the presence of a '.nosync' file
|
||||
if (checkMount) {
|
||||
// we were asked to check the mounts
|
||||
if (exists(syncDir ~ "/.nosync")) {
|
||||
log.log("\nERROR: .nosync file found. Aborting synchronization process to safeguard data.");
|
||||
onedrive.http.shutdown();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
// Do we need to create or remove a directory?
|
||||
if ((createDirectory != "") || (removeDirectory != "")) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue