equal
deleted
inserted
replaced
636 actions.add(new PrivilegedAction<InputStream>() { |
636 actions.add(new PrivilegedAction<InputStream>() { |
637 public InputStream run() { |
637 public InputStream run() { |
638 File javahome = new File(System.getProperties() |
638 File javahome = new File(System.getProperties() |
639 .getProperty("java.home")); |
639 .getProperty("java.home")); |
640 File libaudio = new File(new File(javahome, "lib"), "audio"); |
640 File libaudio = new File(new File(javahome, "lib"), "audio"); |
641 if (libaudio.exists()) { |
641 if (libaudio.isDirectory()) { |
642 File foundfile = null; |
642 File foundfile = null; |
643 File[] files = libaudio.listFiles(); |
643 File[] files = libaudio.listFiles(); |
644 if (files != null) { |
644 if (files != null) { |
645 for (int i = 0; i < files.length; i++) { |
645 for (int i = 0; i < files.length; i++) { |
646 File file = files[i]; |
646 File file = files[i]; |
684 |
684 |
685 /* |
685 /* |
686 * Look for a default.sf2 |
686 * Look for a default.sf2 |
687 */ |
687 */ |
688 for (File systemSoundFontDir : systemSoundFontsDir) { |
688 for (File systemSoundFontDir : systemSoundFontsDir) { |
689 if (systemSoundFontDir.exists()) { |
689 if (systemSoundFontDir.isDirectory()) { |
690 File defaultSoundFont = new File(systemSoundFontDir, "default.sf2"); |
690 File defaultSoundFont = new File(systemSoundFontDir, "default.sf2"); |
691 if (defaultSoundFont.exists()) { |
691 if (defaultSoundFont.isFile()) { |
692 try { |
692 try { |
693 return new FileInputStream(defaultSoundFont); |
693 return new FileInputStream(defaultSoundFont); |
694 } catch (IOException e) { |
694 } catch (IOException e) { |
695 // continue with lookup |
695 // continue with lookup |
696 } |
696 } |
706 public InputStream run() { |
706 public InputStream run() { |
707 if (System.getProperties().getProperty("os.name") |
707 if (System.getProperties().getProperty("os.name") |
708 .startsWith("Windows")) { |
708 .startsWith("Windows")) { |
709 File gm_dls = new File(System.getenv("SystemRoot") |
709 File gm_dls = new File(System.getenv("SystemRoot") |
710 + "\\system32\\drivers\\gm.dls"); |
710 + "\\system32\\drivers\\gm.dls"); |
711 if (gm_dls.exists()) { |
711 if (gm_dls.isFile()) { |
712 try { |
712 try { |
713 return new FileInputStream(gm_dls); |
713 return new FileInputStream(gm_dls); |
714 } catch (IOException e) { |
714 } catch (IOException e) { |
715 } |
715 } |
716 } |
716 } |
726 */ |
726 */ |
727 File userhome = new File(System.getProperty("user.home"), |
727 File userhome = new File(System.getProperty("user.home"), |
728 ".gervill"); |
728 ".gervill"); |
729 File emg_soundbank_file = new File(userhome, |
729 File emg_soundbank_file = new File(userhome, |
730 "soundbank-emg.sf2"); |
730 "soundbank-emg.sf2"); |
731 if (emg_soundbank_file.exists()) { |
731 if (emg_soundbank_file.isFile()) { |
732 try { |
732 try { |
733 return new FileInputStream(emg_soundbank_file); |
733 return new FileInputStream(emg_soundbank_file); |
734 } catch (IOException e) { |
734 } catch (IOException e) { |
735 } |
735 } |
736 } |
736 } |
771 OutputStream out = AccessController |
771 OutputStream out = AccessController |
772 .doPrivileged((PrivilegedAction<OutputStream>) () -> { |
772 .doPrivileged((PrivilegedAction<OutputStream>) () -> { |
773 try { |
773 try { |
774 File userhome = new File(System |
774 File userhome = new File(System |
775 .getProperty("user.home"), ".gervill"); |
775 .getProperty("user.home"), ".gervill"); |
776 if (!userhome.exists()) { |
776 if (!userhome.isDirectory()) { |
777 userhome.mkdirs(); |
777 if (!userhome.mkdirs()) { |
|
778 return null; |
|
779 } |
778 } |
780 } |
779 File emg_soundbank_file = new File( |
781 File emg_soundbank_file = new File( |
780 userhome, "soundbank-emg.sf2"); |
782 userhome, "soundbank-emg.sf2"); |
781 if (emg_soundbank_file.exists()) { |
783 if (emg_soundbank_file.isFile()) { |
782 return null; |
784 return null; |
783 } |
785 } |
784 return new FileOutputStream(emg_soundbank_file); |
786 return new FileOutputStream(emg_soundbank_file); |
785 } catch (final FileNotFoundException ignored) { |
787 } catch (final FileNotFoundException ignored) { |
786 } |
788 } |