aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTeddy Wing2018-10-25 19:55:21 +0200
committerTeddy Wing2018-10-25 19:55:21 +0200
commitb854b50348c566cb1c3fb3f8f76610e90492bae6 (patch)
treeaeee2a39a4d4d3c019f86a2d897a358bbc73f281 /lib
parent0c25fdc79f6aeec643c9c91caeaacbc0813d206c (diff)
downloadDomeKey-b854b50348c566cb1c3fb3f8f76610e90492bae6.tar.bz2
LicenseHandler: Implement `addLicense:` method
Copies the given license into XDG_DATA_HOME and validates it. This allows us to keep the user's license in a consistent location where it can be validated on every launch. Errors are printed to stderr. If the license file fails validation, it gets moved to the trash. The original license file passed in by the user will remain intact, only the one copied to XDG_DATA_HOME gets removed. Call the function from `main` with a temporary hard-coded value to test out the function. The real path value will come from a command-line argument. We may end up removing the `validateLicense` call and subsequent related code here if it always gets called anyway. Still not sure if it should look like: if (--license passed in) { [LicenseHandler addLicense:l]; } else { [LicenseHandler check]; } or if (--license passed in) { [LicenseHandler addLicense:l]; } [LicenseHandler check]; If the second, we should keep some kind of trashing functionality as otherwise a subsequent `addLicense:` call will result in an error like this: dome-key: error: “dome-key-license.plist” couldn’t be copied to “dome-key” because an item with the same name already exists. TODO: `trashItemAtURL:resultingItemURL:error:` was introduced in OS X 10.8. We need to change this to use an `NSWorkspace` method.
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions