@Override public Preferences getPreferences (String name) { File libraryPath = new File(System.getenv("HOME"), "Library"); File finalPath = new File(libraryPath, name + ".plist"); @SuppressWarnings("unchecked") NSMutableDictionary<NSString, NSObject> nsDictionary = (NSMutableDictionary<NSString, NSObject>)NSMutableDictionary .read(finalPath); // if it fails to get an existing dictionary, create a new one. if (nsDictionary == null) { nsDictionary = new NSMutableDictionary<NSString, NSObject>(); nsDictionary.write(finalPath, false); } return new IOSPreferences(nsDictionary, finalPath.getAbsolutePath()); }
@Override public Preferences getPreferences (String name) { File libraryPath = new File(System.getenv("HOME"), "Library"); File finalPath = new File(libraryPath, name + ".plist"); @SuppressWarnings("unchecked") NSMutableDictionary<NSString, NSObject> nsDictionary = (NSMutableDictionary<NSString, NSObject>)NSMutableDictionary .read(finalPath); // if it fails to get an existing dictionary, create a new one. if (nsDictionary == null) { nsDictionary = new NSMutableDictionary<NSString, NSObject>(); nsDictionary.write(finalPath, false); } return new IOSPreferences(nsDictionary, finalPath.getAbsolutePath()); }
@Method(selector = "dictionaryWithContentsOfURL:") public static native NSMutableDictionary<?, ?> read(NSURL url);
IOSSettings(String name) { path = new File(new File(System.getenv("HOME"), "Library"), name + ".plist"); preferences = NSMutableDictionary.read(path); if (preferences == null) { preferences = new NSMutableDictionary<>(); preferences.write(path, false); } }
@Method(selector = "dictionaryWithContentsOfURL:") public static native NSMutableDictionary<?, ?> read(NSURL url);
@Override public Preferences getPreferences (String name) { File libraryPath = new File(System.getenv("HOME"), "Library"); File finalPath = new File(libraryPath, name + ".plist"); @SuppressWarnings("unchecked") NSMutableDictionary<NSString, NSObject> nsDictionary = (NSMutableDictionary<NSString, NSObject>)NSMutableDictionary .read(finalPath); // if it fails to get an existing dictionary, create a new one. if (nsDictionary == null) { nsDictionary = new NSMutableDictionary<NSString, NSObject>(); nsDictionary.write(finalPath, false); } return new IOSPreferences(nsDictionary, finalPath.getAbsolutePath()); }
@Method(selector = "dictionaryWithContentsOfURL:") public static native NSMutableDictionary<?, ?> read(NSURL url);