/** * Gets the current user's application data directory. * * @return the current user's application data directory * * @since BEAM 4.2 */ public static File getApplicationDataDir() { return getApplicationDataDir(false); }
/** * Gets the default BEAM cache directory. This is the directory * where BEAM stores temporary data. * * @return the default cache directory */ public static File getDefaultBeamCacheDir() { return new File(getApplicationDataDir(), CACHE_DIR_NAME); }
private File getSystemAuxdataDir() { return new File(SystemUtils.getApplicationDataDir(), "beam-ui/auxdata/color-palettes"); }
private File getDefaultAuxdataInstallDir() { return new File(SystemUtils.getApplicationDataDir(), PROCESSOR_SYMBOLIC_NAME + "/auxdata"); }
String getAuxdataInstallationPath() { File defaultAuxdataDir = new File(SystemUtils.getApplicationDataDir(), AUXDATA_DIR); return System.getProperty(CloudPN.CLOUD_AUXDATA_DIR_PROPERTY, defaultAuxdataDir.getAbsolutePath()); }
private static void initGeoTools() { // Must store EPSG database in BEAM home, otherwise it will be deleted from default temp location (Unix!, Windows?) File epsgDir = new File(SystemUtils.getApplicationDataDir(true), EPSG_DATABASE_DIR_NAME); System.setProperty(HsqlEpsgDatabase.DIRECTORY_KEY, epsgDir.getAbsolutePath()); }
@SuppressWarnings("ResultOfMethodCallIgnored") private static File getSystemAuxDataDir() { File file = new File(SystemUtils.getApplicationDataDir(), "beam-ui" + File.separator + "auxdata" + File.separator + "band-sets"); if (!file.exists()) { file.mkdir(); } return file; }
private void initBeamUserDir() throws IOException { String userHome = System.getProperty("user.home"); if (userHome == null) { throw new IllegalStateException("Java system property 'user.home' not set"); } beamUserDir = SystemUtils.getApplicationDataDir(true); appUserDir = new File(beamUserDir, getAppSymbolicName()); if (!appUserDir.exists() && !appUserDir.mkdir()) { throw new IOException("Failed to create directory '" + appUserDir + "'."); } }
protected AbstractElevationModelDescriptor() { demPropertiesDir = new File(SystemUtils.getApplicationDataDir(), "beam-core/auxdata/dem" + File.separator + getName()); if (!demPropertiesDir.exists()) { demPropertiesDir.mkdirs(); } demInstallDir = demPropertiesDir; maybeOverwriteDemInstallDir(); }
static File installAuxdata() throws IOException { File defaultAuxdataInstallDir = new File(SystemUtils.getApplicationDataDir(), "beam-meris-radiometry/smile-correction/auxdata"); String auxdataDirPath = System.getProperty(AUXDATA_DIR_PROPERTY, defaultAuxdataInstallDir.getAbsolutePath()); File auxdataDirectory = new File(auxdataDirPath); URL sourceUrl = ResourceInstaller.getSourceUrl(SmileCorrectionAuxdata.class); final ResourceInstaller resourceInstaller = new ResourceInstaller(sourceUrl, "auxdata/smile", auxdataDirectory); resourceInstaller.install(".*", ProgressMonitor.NULL); return auxdataDirectory; } }
private File installAuxiliaryData() { final File defaultTargetDir = new File(SystemUtils.getApplicationDataDir(), "beam-aatsr-sst/auxdata/aatsr/sst"); final String targetPath = System.getProperty(SST_AUXDATA_DIR_PROPERTY, defaultTargetDir.getAbsolutePath()); final File targetDir = new File(targetPath); final URL url = ResourceInstaller.getSourceUrl(getClass()); final ResourceInstaller installer = new ResourceInstaller(url, "auxdata/aatsr/sst", targetDir); try { installer.install(".*", ProgressMonitor.NULL); } catch (IOException e) { throw new OperatorException(e); } return targetDir; }
@Test public void testGetApplicationDataDir() { final File applicationDataDir = SystemUtils.getApplicationDataDir(); assertNotNull(applicationDataDir); final String prefix = SystemUtils.getUserHomeDir().getPath(); assertTrue(applicationDataDir.getPath().startsWith(prefix)); }