Returns the path to the directory where the preferences file (IJPrefs.txt) is saved.
()
| 457 | /** Returns the path to the directory where the |
| 458 | preferences file (IJPrefs.txt) is saved. */ |
| 459 | @AstroImageJ(reason = "rename for AIJ", modified = true) |
| 460 | public static String getPrefsDir() { |
| 461 | // look in current directory |
| 462 | if (prefsDir==null) { |
| 463 | String cwd = System.getProperty("user.dir"); |
| 464 | File f = new File(cwd+File.separator+PREFS_NAME); |
| 465 | if (f.exists()) { |
| 466 | prefsDir = cwd; |
| 467 | preferencesPath = cwd+"/"+PREFS_NAME; |
| 468 | } |
| 469 | // look in ImageJ directory |
| 470 | if (prefsDir==null) { |
| 471 | String ijDir = getImageJDir(); |
| 472 | ijDir = ijDir.substring(0, ijDir.length()-1); |
| 473 | f = new File(ijDir+File.separator+PREFS_NAME); |
| 474 | if (f.exists()) { |
| 475 | prefsDir = ijDir; |
| 476 | preferencesPath = ijDir+"/"+PREFS_NAME; |
| 477 | } |
| 478 | } |
| 479 | // use home directory |
| 480 | if (prefsDir==null) { |
| 481 | String dir = System.getProperty("user.home"); |
| 482 | if (IJ.isMacOSX()) |
| 483 | dir += "/Library/Preferences"; |
| 484 | else |
| 485 | dir += File.separator+".astroimagej"; |
| 486 | prefsDir = dir; |
| 487 | } |
| 488 | } |
| 489 | return prefsDir; |
| 490 | } |
| 491 | |
| 492 | /** Sets the path to the ImageJ directory. */ |
| 493 | static void setHomeDir(String path) { |
no test coverage detected