File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
src/main/java/org/scijava/app Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 3131
3232package org .scijava .app ;
3333
34+ import java .io .File ;
35+
3436import org .scijava .plugin .AbstractRichPlugin ;
37+ import org .scijava .util .AppUtils ;
3538import org .scijava .util .Manifest ;
3639import org .scijava .util .POM ;
3740
@@ -95,4 +98,14 @@ public String getInfo(boolean mem) {
9598 return sb .toString ();
9699 }
97100
101+ @ Override
102+ public String getSystemProperty () {
103+ return getInfo ().getName ().toLowerCase () + ".dir" ;
104+ }
105+
106+ @ Override
107+ public File getBaseDirectory () {
108+ return AppUtils .getBaseDirectory (getSystemProperty (), getClass (), null );
109+ }
110+
98111}
Original file line number Diff line number Diff line change 3131
3232package org .scijava .app ;
3333
34+ import java .io .File ;
35+
3436import org .scijava .plugin .Plugin ;
3537import org .scijava .plugin .RichPlugin ;
3638import org .scijava .plugin .SingletonPlugin ;
@@ -91,4 +93,17 @@ public interface App extends RichPlugin, SingletonPlugin {
9193 */
9294 String getInfo (boolean mem );
9395
96+ /**
97+ * A system property which, if set, overrides the base directory of the
98+ * application.
99+ */
100+ String getSystemProperty ();
101+
102+ /**
103+ * Gets the application's root directory. If the application's system property
104+ * is set, it is used. Otherwise, we scan up the tree from this class for a
105+ * suitable directory.
106+ */
107+ File getBaseDirectory ();
108+
94109}
You can’t perform that action at this time.
0 commit comments