コード例 #1
0
 def _migrateEditWith(self, ext):
     """ Migrate older "Edit with Komodo" to "Edit with Komodo IDE|EDIT",
         also from HKLM to HKCU"""
     import wininteg
     try:
         try:
             found = wininteg.removeFileAssociation(ext, "Edit with Komodo",
                                                    self._komodo, fromHKLM=True)
         except WindowsError, ex:
             if ex.winerror != 5: # ERROR_ACCESS_DENIED
                 raise
             return False
         if not found:
             return False
         wininteg.addFileAssociation(ext, "Edit with %s" % (self._appName,), self._komodo)
         return True
コード例 #2
0
    def _addFileAssociation(self, ext, action):
        import wininteg
        try:
            if action.endswith(self._appName):
                untypedAction = action[:-len(self._appName)] + "Komodo"
                try:
                    if wininteg.removeFileAssociation(ext, untypedAction,
                                                      self._komodo, fromHKLM=True):
                        log.info("Removed untyped action %r", untypedAction)
                except WindowsError, ex:
                    if ex.winerror != 5: # ERROR_ACCESS_DENIED
                        raise
                    # can't remove the untyped action, don't add
                    # the new one either (to prevent duplicates)
                    log.info("Failed to remove untyped action %r, not adding typed action %r",
                             untypedAction, action)
                    return

            wininteg.addFileAssociation(ext, action, self._komodo)
コード例 #3
0
 def _migrateEditWith(self, ext):
     """ Migrate older "Edit with Komodo" to "Edit with Komodo IDE|EDIT",
         also from HKLM to HKCU"""
     import wininteg
     try:
         try:
             found = wininteg.removeFileAssociation(ext,
                                                    "Edit with Komodo",
                                                    self._komodo,
                                                    fromHKLM=True)
         except WindowsError, ex:
             if ex.winerror != 5:  # ERROR_ACCESS_DENIED
                 raise
             return False
         if not found:
             return False
         wininteg.addFileAssociation(ext,
                                     "Edit with %s" % (self._appName, ),
                                     self._komodo)
         return True
コード例 #4
0
    def _addFileAssociation(self, ext, action):
        import wininteg
        try:
            if action.endswith(self._appName):
                untypedAction = action[:-len(self._appName)] + "Komodo"
                try:
                    if wininteg.removeFileAssociation(ext,
                                                      untypedAction,
                                                      self._komodo,
                                                      fromHKLM=True):
                        log.info("Removed untyped action %r", untypedAction)
                except WindowsError, ex:
                    if ex.winerror != 5:  # ERROR_ACCESS_DENIED
                        raise
                    # can't remove the untyped action, don't add
                    # the new one either (to prevent duplicates)
                    log.info(
                        "Failed to remove untyped action %r, not adding typed action %r",
                        untypedAction, action)
                    return

            wininteg.addFileAssociation(ext, action, self._komodo)
コード例 #5
0
 def _removeFileAssociation(self, ext, action):
     import wininteg
     try:
         if action.endswith(self._appName):
             untypedAction = action[:-len(self._appName)] + "Komodo"
             wininteg.removeFileAssociation(ext, untypedAction,
                                            self._komodo, fromHKLM=True)
         try:
             wininteg.removeFileAssociation(ext, action, self._komodo)
         except WindowsError, ex:
             if ex.winerror != 2: # FILE_NOT_FOUND
                 raise
             # perhaps it's under HKLM
             wininteg.removeFileAssociation(ext, action, self._komodo, fromHKLM=True)
     except WindowsError, ex:
         self.lastErrorSvc.setLastError(ex.errno, ex.strerror)
         raise ServerException(nsError.NS_ERROR_UNEXPECTED, ex.strerror)
コード例 #6
0
 def _removeFileAssociation(self, ext, action):
     import wininteg
     try:
         if action.endswith(self._appName):
             untypedAction = action[:-len(self._appName)] + "Komodo"
             wininteg.removeFileAssociation(ext,
                                            untypedAction,
                                            self._komodo,
                                            fromHKLM=True)
         try:
             wininteg.removeFileAssociation(ext, action, self._komodo)
         except WindowsError, ex:
             if ex.winerror != 2:  # FILE_NOT_FOUND
                 raise
             # perhaps it's under HKLM
             wininteg.removeFileAssociation(ext,
                                            action,
                                            self._komodo,
                                            fromHKLM=True)
     except WindowsError, ex:
         self.lastErrorSvc.setLastError(ex.errno, ex.strerror)
         raise ServerException(nsError.NS_ERROR_UNEXPECTED, ex.strerror)