Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite file operations for updating an app #575

Merged
merged 18 commits into from
Sep 25, 2015

Commits on Jul 23, 2015

  1. Rewrote file operations for updating an app

    The improvements we want to achieve:
    * Stability - No more corrupt / incomplete updates by ensuring atomic move operations
    * Efficiency - Faster updates because of reduction of file copies that need to be done
    * Separation from Host and Helper - No usage of SUFileManager in the host application
    * Cleanness - Minimized deprecated APIs (no FSPathMakeRef, FSGetCatalogInfo, FSFindFolder, etc), use modern Cocoa APIs when possible, robust error handling, strong documentation, easier to read code.
    
    Many other small notes:
    * SUFileManager does not have class methods. Methods across an instance share an AuthorizationRef, instead of having to authorize every time a privileged operation needs to be done
    * The odd logic of `while (authStat == errAuthorizationDenied)` was removed
    * Instead of checking if we have write access, we try to invoke a normal operation first. If that doesn't work, with the right error returned back, we try authorizing, which is what Apple recommends doing
    * The trash is not used as a temporary location anymore. Rather we now request for a temporary directory to be created. This is more likely to succeed too (eg: on a drive that has no trash folder)
    * The old method for releasing the quarantine did not work until I used the "com.apple.quarantine" key instead of the LS constant that was being used.
    * For the old method for releasing the quarantine, we now check if a file has the quarantine xattr bit set before removing it. Just like how the new method works.
    * Quarantines can now be removed with authorization
    * The result of calling temporaryNameForPath: was never actually used in the old code
    * -[NSString fileSystemRepresentation] which can throw an exception is not used. Only getFileSystemRepresentation:maxLength: is used and the error on it is always checked
    * The desperate/hopeless check for if the code signature for the update is valid after the installation is complete is removed
    
    Potential issues that still needs to be looked in to:
    * Currently the method to move a file to the trash only works on 10.8+
    * Appending of version number / picking destination name of app moved to trash
    zorgiepoo committed Jul 23, 2015
    Configuration menu
    Copy the full SHA
    984c3dc View commit details
    Browse the repository at this point in the history

Commits on Jul 24, 2015

  1. Configuration menu
    Copy the full SHA
    9c8fb99 View commit details
    Browse the repository at this point in the history

Commits on Jul 25, 2015

  1. Configuration menu
    Copy the full SHA
    19876c5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d4b7a69 View commit details
    Browse the repository at this point in the history
  3. Make errors/directory names more user friendly

    Since it is possible for the user to see these strings, we should not make them seem as 'gibberish' or unfriendly. More detailed error information is logged to the console.
    zorgiepoo committed Jul 25, 2015
    Configuration menu
    Copy the full SHA
    dbae37b View commit details
    Browse the repository at this point in the history

Commits on Jul 27, 2015

  1. Configuration menu
    Copy the full SHA
    62f7b7a View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2015

  1. Configuration menu
    Copy the full SHA
    a746219 View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2015

  1. Configuration menu
    Copy the full SHA
    fd7628e View commit details
    Browse the repository at this point in the history
  2. Release quarantine for Autoupdate.app

    I don't think this is actually needed, but better be safe than sorry.
    zorgiepoo committed Aug 15, 2015
    Configuration menu
    Copy the full SHA
    ea959cb View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5d53d72 View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2015

  1. Remove installation URL != old URL case

    By not taking account the rare case, we simplify the code by having
    less duplication. The tradeoff is that the rare case will be slightly
    less efficient.
    zorgiepoo committed Aug 16, 2015
    Configuration menu
    Copy the full SHA
    758ed1d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5b469d7 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ba73e52 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    182652a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2782b42 View commit details
    Browse the repository at this point in the history

Commits on Sep 18, 2015

  1. Configuration menu
    Copy the full SHA
    d1a5aae View commit details
    Browse the repository at this point in the history

Commits on Sep 19, 2015

  1. Configuration menu
    Copy the full SHA
    bd3be28 View commit details
    Browse the repository at this point in the history

Commits on Sep 24, 2015

  1. Configuration menu
    Copy the full SHA
    a9743f0 View commit details
    Browse the repository at this point in the history