@synchronized(DIR_LOCK)
def get_unique_path(dirpath, n=0, create_dir=True):
 if (not check_mount(dirpath)):
  return dirpath
 path = dirpath
 if n:
  path = ('%s.%s' % (dirpath, n))
 if (not os.path.exists(path)):
  if create_dir:
   return create_dirs(path)
  else:
   return path
 else:
  return get_unique_path(dirpath, n=(n + 1), create_dir=create_dir)

@ synchronized ( DIR_LOCK ) def get_unique_path ( dirpath , n = 0 , create_dir = True ) : if ( not check_mount ( dirpath ) ) : return dirpath path = dirpath if n : path = ( '%s.%s' % ( dirpath , n ) ) if ( not os . path . exists ( path ) ) : if create_dir : return create_dirs ( path ) else : return path else : return get_unique_path ( dirpath , n = ( n + 1 ) , create_dir = create_dir )
determine a unique folder or filename .