/** * Locates the NetBeans user directory. * This may be used to persist valuable files for which the system filesystem * ({@code FileUtil.getConfigFile}) is inappropriate due its being virtual. * Each module is responsible for using sufficiently unique filenames within this directory. * The system property {@link #USER_DIR_PROP} is used for compatibility. * @return a directory location (need not yet exist), or null if unconfigured */ public static synchronized /*@CheckForNull*/ File getUserDirectory() { Places places = Lookup.getDefault().lookup(Places.class); if (places != null) { return places.findUserDirectory(); } String p = System.getProperty("netbeans.user"); return p != null ? new File(p) : null; }