diff options
-rw-r--r-- | DomeKey/LicenseHandler.m | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/DomeKey/LicenseHandler.m b/DomeKey/LicenseHandler.m index 576e255..780efef 100644 --- a/DomeKey/LicenseHandler.m +++ b/DomeKey/LicenseHandler.m @@ -75,7 +75,8 @@ static NSString * const LICENSE_FILE_NAME = @"license.plist"; BOOL moved = [[NSFileManager defaultManager] moveItemAtURL:[self licensePath] - toURL:trash_url + toURL:[trash_url + URLByAppendingPathComponent:[self trashedLicenseFilename]] error:&error]; if (!moved) { @@ -89,6 +90,17 @@ static NSString * const LICENSE_FILE_NAME = @"license.plist"; // If license does validate, print a success message } ++ (NSString *)trashedLicenseFilename +{ + NSDate *now = [NSDate date]; + NSDateFormatter *date_formatter = [[NSDateFormatter alloc] init]; + [date_formatter setDateFormat:@"yyyy-MM-dd-HH.mm.ss"]; + NSString *date_string = [date_formatter stringFromDate:now]; + return [NSString + stringWithFormat:@"dome-key-license-%@.plist", + date_string]; +} + + (NSURL *)licensePath { return [[XDG domeKeyDataPath] |