(String[] resources)
| 915 | } |
| 916 | |
| 917 | private void install(String[] resources) |
| 918 | { |
| 919 | for (String resource : resources) |
| 920 | { |
| 921 | File resourceFile = AppProperties.GetSettingsFilePath(resource); |
| 922 | |
| 923 | if (resourceFile.exists()) |
| 924 | continue; |
| 925 | |
| 926 | String jarpath = "/" + resource; |
| 927 | InputStream is = this.getClass().getResourceAsStream(jarpath); |
| 928 | |
| 929 | if (is == null) |
| 930 | { |
| 931 | System.err.println("Failed to find " + jarpath |
| 932 | + " in the JAR file"); |
| 933 | continue; |
| 934 | } |
| 935 | |
| 936 | // Create the new file on disk |
| 937 | try |
| 938 | { |
| 939 | FileOutputStream os = new FileOutputStream(resourceFile); |
| 940 | |
| 941 | // Copy the file onto disk |
| 942 | byte bytes[] = new byte[2048]; |
| 943 | int read; |
| 944 | while (true) |
| 945 | { |
| 946 | read = is.read(bytes); |
| 947 | |
| 948 | // EOF |
| 949 | if (read == -1) |
| 950 | break; |
| 951 | |
| 952 | os.write(bytes, 0, read); |
| 953 | } |
| 954 | |
| 955 | is.close(); |
| 956 | os.close(); |
| 957 | |
| 958 | System.out.println("Installed " + resourceFile |
| 959 | + " onto the local disk from JAR file"); |
| 960 | } |
| 961 | catch (IOException e) |
| 962 | { |
| 963 | e.printStackTrace(); |
| 964 | System.err.println("Failed to install " + resourceFile); |
| 965 | } |
| 966 | } |
| 967 | } |
| 968 | |
| 969 | public Font getTextFont() |
| 970 | { |
no test coverage detected