-
- OwnCloudFileObserver observer = mObserversMap.get(localPath);
- if (observer == null) {
- observer = new OwnCloudFileObserver(localPath, account, getApplicationContext(), mHandler);
- mObserversMap.put(localPath, observer);
-
- // only if being added
- if (new File(localPath).exists()) {
- observer.startWatching();
- Log_OC.d(TAG, "Started watching file " + localPath);
- }
- }
-
- String parentPath = (new File(localPath)).getParent();
- OwnCloudFolderObserver observerFolder = mObserversFolderMap.get(parentPath);
- if (observerFolder == null) {
- observerFolder = new OwnCloudFolderObserver(parentPath, account, getApplicationContext());
- mObserversFolderMap.put(parentPath, observerFolder);
-
- if (new File(parentPath).exists()) {
- observerFolder.startWatching();
- Log_OC.d(TAG, "Started watching parent folder " + parentPath + "/");
- }
- }