@@ -1,7 +1,7 @@ /* - * Copyright (c) 2008-2021 Jonathan Schleifer + * Copyright (c) 2008-2022 Jonathan Schleifer * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in @@ -14,14 +14,15 @@ */ #include "config.h" #import "OFINIFileSettings.h" -#import "OFString.h" #import "OFArray.h" #import "OFINIFile.h" +#import "OFString.h" #import "OFSystemInfo.h" +#import "OFURL.h" @implementation OFINIFileSettings - (instancetype)initWithApplicationName: (OFString *)applicationName { self = [super initWithApplicationName: applicationName]; @@ -29,13 +30,13 @@ @try { void *pool = objc_autoreleasePoolPush(); OFString *fileName; fileName = [applicationName stringByAppendingString: @".ini"]; - _filePath = [[[OFSystemInfo userConfigPath] - stringByAppendingPathComponent: fileName] copy]; - _INIFile = [[OFINIFile alloc] initWithPath: _filePath]; + _fileURL = [[[OFSystemInfo userConfigURL] + URLByAppendingPathComponent: fileName] copy]; + _INIFile = [[OFINIFile alloc] initWithURL: _fileURL]; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; @@ -44,11 +45,11 @@ return self; } - (void)dealloc { - [_filePath release]; + [_fileURL release]; [_INIFile release]; [super dealloc]; } @@ -240,8 +241,8 @@ objc_autoreleasePoolPop(pool); } - (void)save { - [_INIFile writeToFile: _filePath]; + [_INIFile writeToURL: _fileURL]; } @end