summaryrefslogtreecommitdiff
path: root/src/net/sourceforge/plantuml/cucadiagram/dot/OSWindows.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/sourceforge/plantuml/cucadiagram/dot/OSWindows.java')
-rw-r--r--src/net/sourceforge/plantuml/cucadiagram/dot/OSWindows.java97
1 files changed, 0 insertions, 97 deletions
diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/OSWindows.java b/src/net/sourceforge/plantuml/cucadiagram/dot/OSWindows.java
deleted file mode 100644
index d68ff16..0000000
--- a/src/net/sourceforge/plantuml/cucadiagram/dot/OSWindows.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2017, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * This file is part of PlantUML.
- *
- * Licensed under The MIT License (Massachusetts Institute of Technology License)
- *
- * See http://opensource.org/licenses/MIT
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
- * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * Original Author: Arnaud Roques
- */
-package net.sourceforge.plantuml.cucadiagram.dot;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import net.sourceforge.plantuml.StringUtils;
-
-class OSWindows extends OS {
-
- @Override
- File getExecutable(GraphvizLayoutStrategy strategy) {
- File result = strategy.getSystemForcedExecutable();
- if (result != null) {
- return result;
- }
- result = searchInDir(new File("c:/Program Files"), strategy);
- if (result != null) {
- return result;
- }
- result = searchInDir(new File("c:/Program Files (x86)"), strategy);
- return result;
- }
-
- private File searchInDir(final File programFile, GraphvizLayoutStrategy strategy) {
- if (programFile.exists() == false || programFile.isDirectory() == false) {
- return null;
- }
- final List<File> dots = new ArrayList<File>();
- for (File f : programFile.listFiles(new FileFilter() {
- public boolean accept(File pathname) {
- return pathname.isDirectory() && pathname.getName().startsWith("Graphviz");
- }
- })) {
- final File result = new File(new File(f, "bin"), getFileName(strategy));
- if (result.exists() && result.canRead()) {
- dots.add(result.getAbsoluteFile());
- }
- }
- return higherVersion(dots);
- }
-
- static File higherVersion(List<File> dots) {
- if (dots.size() == 0) {
- return null;
- }
- Collections.sort(dots, Collections.reverseOrder());
- return dots.get(0);
- }
-
- @Override
- String getFileName(GraphvizLayoutStrategy strategy) {
- return StringUtils.goLowerCase(strategy.name()) + ".exe";
- }
-
- @Override
- public String getCommand(GraphvizLayoutStrategy strategy) {
- return "\"" + getExecutable(strategy).getAbsolutePath() + "\"";
- }
-
-}