- addObservedFile(
- (OCFile)intent.getParcelableExtra(KEY_CMD_ARG_FILE),
- (Account)intent.getParcelableExtra(KEY_CMD_ARG_ACCOUNT)
- );
-
+ OCFile file = (OCFile) intent.getParcelableExtra(KEY_CMD_ARG_FILE);
+ Account account = (Account) intent.getParcelableExtra(KEY_CMD_ARG_ACCOUNT);
+ addObservedFile(file, account);
+
+ String localPath = file.getStoragePath();
+ if (localPath == null || localPath.length() <= 0) {
+ // file downloading or to be downloaded for the first time
+ localPath = FileStorageUtils.getDefaultSavePathFor(account.name, file);
+ }
+
+ String parentPath = (new File(localPath)).getParent();
+
+ addObservedFolder(parentPath, account);
+