40
40
import java .io .File ;
41
41
import java .io .IOException ;
42
42
import java .io .InputStream ;
43
+ import java .nio .file .Files ;
44
+ import java .nio .file .InvalidPathException ;
45
+ import java .nio .file .Path ;
46
+ import java .nio .file .Paths ;
47
+ import java .util .ArrayList ;
48
+ import java .util .List ;
43
49
import java .util .Properties ;
44
50
import javafx .fxml .FXML ;
45
51
import javafx .scene .control .TextArea ;
@@ -57,7 +63,7 @@ public final class AboutWindowController extends AbstractFxmlWindowController {
57
63
private GridPane vbox ;
58
64
@ FXML
59
65
private TextArea textArea ;
60
-
66
+
61
67
private String sbBuildInfo ;
62
68
private String sbBuildVersion ;
63
69
private String sbBuildDate ;
@@ -87,7 +93,7 @@ public AboutWindowController() {
87
93
// We go with default values
88
94
}
89
95
}
90
-
96
+
91
97
@ FXML
92
98
public void onMousePressed (MouseEvent event ) {
93
99
if ((event .getClickCount () == 2 ) && event .isAltDown ()) {
@@ -128,28 +134,45 @@ private String getAboutText() {
128
134
.append (getLoggingParagraph ())
129
135
.append (getJavaFXParagraph ())
130
136
.append (getJavaParagraph ())
137
+ .append (getJavaLibraryPathParagraph ())
131
138
.append (getOsParagraph ())
139
+ .append (getApplicationDirectoriesParagraph ())
132
140
.append (I18N .getString (sbAboutCopyrightKeyName ));
133
141
134
142
return text .toString ();
135
143
}
136
-
144
+
145
+ private StringBuilder getApplicationDirectoriesParagraph () {
146
+ return new StringBuilder (I18N .getString ("about.app.data.directory" ))
147
+ .append ("\n \t " ) // NOI18N
148
+ .append (Paths .get (AppPlatform .getApplicationDataFolder ()).normalize ()) //NOI18N
149
+ .append ("\n \n " ) //NOI18N
150
+ .append (I18N .getString ("about.app.user.library" ))
151
+ .append ("\n \t " ) //NOI18N
152
+ .append (Paths .get (AppPlatform .getUserLibraryFolder ()).normalize ()) //NOI18N
153
+ .append ("\n \n " ) //NOI18N
154
+ .append (I18N .getString ("about.app.program.directory" ))
155
+ .append ("\n \t " ) //NOI18N
156
+ .append (Paths .get ("." ).toAbsolutePath ().normalize ()) //NOI18N
157
+ .append ("\n \n " ); //NOI18N
158
+ }
159
+
137
160
/**
138
161
*
139
162
* @treatAsPrivate
140
163
*/
141
164
public String getBuildJavaVersion () {
142
165
return sbBuildJavaVersion ;
143
166
}
144
-
167
+
145
168
/**
146
169
*
147
170
* @treatAsPrivate
148
171
*/
149
172
public String getBuildInfo () {
150
173
return sbBuildInfo ;
151
174
}
152
-
175
+
153
176
private StringBuilder getVersionParagraph () {
154
177
StringBuilder sb = new StringBuilder (I18N .getString ("about.product.version" ));
155
178
sb .append ("\n JavaFX Scene Builder " ).append (sbBuildVersion ) //NOI18N
@@ -194,11 +217,50 @@ private StringBuilder getJavaFXParagraph() {
194
217
195
218
private StringBuilder getJavaParagraph () {
196
219
StringBuilder sb = new StringBuilder ("Java\n " ); //NOI18N
197
- sb .append (System .getProperty ("java.runtime.version" )).append (", " ) //NOI18N
198
- .append (System .getProperty ("java.vendor" )).append ("\n \n " ); //NOI18N
220
+ sb .append (System .getProperty ("java.version" )).append (", " ) //NOI18N
221
+ .append (System .getProperty ("java.runtime.name" )) // NOI18N
222
+ .append ("\n \n " );
199
223
return sb ;
200
224
}
201
225
226
+ private StringBuilder getJavaLibraryPathParagraph () {
227
+ StringBuilder sb = new StringBuilder (I18N .getString ("about.java.library.paths" ))
228
+ .append ("\n " ); //NOI18N
229
+ String libPaths = System .getProperty ("java.library.path" ); //NOI18N
230
+ List <String > invalidPaths = new ArrayList <>();
231
+ String separator = getPathSeparator ();
232
+ for (String libPath : libPaths .split (separator )) {
233
+ try {
234
+ Path absolutePath = Paths .get (libPath ).normalize ().toAbsolutePath ();
235
+ if (Files .exists (absolutePath )) {
236
+ String path = absolutePath .toString ();
237
+ sb .append ("\t " ).append (path ).append ("\n " );
238
+ } else {
239
+ invalidPaths .add (libPath );
240
+ }
241
+ } catch (InvalidPathException error ) {
242
+ invalidPaths .add (libPath );
243
+ }
244
+ }
245
+ sb .append ("\n " );
246
+ if (!invalidPaths .isEmpty ()) {
247
+ sb .append (I18N .getString ("about.java.library.paths.invalids" )); //NOI18N
248
+ sb .append ("\n " );
249
+ invalidPaths .forEach (invalidPath -> sb .append ("\t " ).append (invalidPath ).append ("\n " ));
250
+ sb .append ("\n " );
251
+ }
252
+ return sb ;
253
+ }
254
+
255
+ private String getPathSeparator () {
256
+ String os = System .getProperty ("os.name" ).toLowerCase ();
257
+ if (os .indexOf ("win" ) >= 0 ) {
258
+ return ";" ;
259
+ } else {
260
+ return ":" ;
261
+ }
262
+ }
263
+
202
264
private StringBuilder getOsParagraph () {
203
265
StringBuilder sb = new StringBuilder (I18N .getString ("about.operating.system" ));
204
266
sb .append ("\n " ).append (System .getProperty ("os.name" )).append (", " ) //NOI18N
0 commit comments