Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 1 | // Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file |
| 2 | // for details. All rights reserved. Use of this source code is governed by a |
| 3 | // BSD-style license that can be found in the LICENSE file. |
| 4 | package utils; |
| 5 | |
Ian Zerny | a8b7d42 | 2022-03-31 11:20:49 +0200 | [diff] [blame] | 6 | import java.nio.file.Path; |
| 7 | import java.nio.file.Paths; |
Jean-Marie Henaff | 34d85f7 | 2017-06-14 10:32:04 +0200 | [diff] [blame] | 8 | |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 9 | public class Utils { |
| 10 | public static String toolsDir() { |
Jean-Marie Henaff | 39587a8 | 2017-06-08 15:20:13 +0200 | [diff] [blame] | 11 | String osName = System.getProperty("os.name"); |
| 12 | if (osName.equals("Mac OS X")) { |
| 13 | return "mac"; |
| 14 | } else if (osName.contains("Windows")) { |
| 15 | return "windows"; |
| 16 | } else { |
| 17 | return "linux"; |
| 18 | } |
Mads Ager | 418d1ca | 2017-05-22 09:35:49 +0200 | [diff] [blame] | 19 | } |
Jean-Marie Henaff | 34d85f7 | 2017-06-14 10:32:04 +0200 | [diff] [blame] | 20 | |
Ian Zerny | a8b7d42 | 2022-03-31 11:20:49 +0200 | [diff] [blame] | 21 | public static boolean isWindows() { |
| 22 | return toolsDir().equals("windows"); |
Jake Wharton | 2d7aab8 | 2019-09-13 10:24:26 -0400 | [diff] [blame] | 23 | } |
| 24 | |
Ian Zerny | a8b7d42 | 2022-03-31 11:20:49 +0200 | [diff] [blame] | 25 | public static Path dxExecutable() { |
| 26 | String dxExecutableName = isWindows() ? "dx.bat" : "dx"; |
| 27 | return Paths.get("tools", toolsDir(), "dx", "bin", dxExecutableName); |
| 28 | } |
| 29 | |
| 30 | public static Path dexMergerExecutable() { |
| 31 | String executableName = isWindows() ? "dexmerger.bat" : "dexmerger"; |
| 32 | return Paths.get("tools", toolsDir(), "dx", "bin", executableName); |
Jean-Marie Henaff | 34d85f7 | 2017-06-14 10:32:04 +0200 | [diff] [blame] | 33 | } |
Jake Wharton | 2d7aab8 | 2019-09-13 10:24:26 -0400 | [diff] [blame] | 34 | } |