src/eric7/EricCore/EricFileSystemWatcher.py

branch
eric7
changeset 10993
b83dd2d57e43
parent 10922
36a90a94765c
child 11090
f5f5f5803935
equal deleted inserted replaced
10992:c3b070373492 10993:b83dd2d57e43
252 given path (for directory paths only) (defaults to False) 252 given path (for directory paths only) (defaults to False)
253 @type bool (optional) 253 @type bool (optional)
254 @return flag indicating a successful creation of a watch for the given path 254 @return flag indicating a successful creation of a watch for the given path
255 @rtype bool 255 @rtype bool
256 """ 256 """
257 if os.path.exists(path): 257 if os.path.exists(path) and self.__observer is not None:
258 try: 258 try:
259 self.__paths[path][1] += 1 259 self.__paths[path][1] += 1
260 return True 260 return True
261 except KeyError: 261 except KeyError:
262 try: 262 try:
313 """ 313 """
314 try: 314 try:
315 self.__paths[path][1] -= 1 315 self.__paths[path][1] -= 1
316 if self.__paths[path][1] == 0: 316 if self.__paths[path][1] == 0:
317 watch, _ = self.__paths.pop(path) 317 watch, _ = self.__paths.pop(path)
318 self.__observer.unschedule(watch) 318 if self.__observer is not None:
319 self.__observer.unschedule(watch)
319 return True 320 return True
320 except KeyError: 321 except KeyError:
321 return False 322 return False
322 323
323 def removePaths(self, paths): 324 def removePaths(self, paths):

eric ide

mercurial