+ /**
+ * Check for 'ptypipe' on the path. If available, set ptypipeOnPath.
+ */
+ private static void checkForPtypipe() {
+ String systemPath = System.getenv("PATH");
+ if (systemPath == null) {
+ return;
+ }
+
+ String [] paths = systemPath.split(File.pathSeparator);
+ if (paths == null) {
+ return;
+ }
+ if (paths.length == 0) {
+ return;
+ }
+ for (int i = 0; i < paths.length; i++) {
+ File path = new File(paths[i]);
+ if (path.exists() && path.isDirectory()) {
+ File [] files = path.listFiles();
+ if (files == null) {
+ continue;
+ }
+ if (files.length == 0) {
+ continue;
+ }
+ for (int j = 0; j < files.length; j++) {
+ File file = files[j];
+ if (file.canExecute() && file.getName().equals("ptypipe")) {
+ ptypipeOnPath = true;
+ return;
+ }
+ }
+ }
+ }
+ }
+