This repository contains MadHelix itself, along with compiled libraries with its dependencies.
Clone
HTTPS:
git clone https://vervis.peers.community/repos/ZEkyo
SSH:
git clone USERNAME@vervis.peers.community:ZEkyo
Branches
Tags
PathUtils.java
/*
* UltrasonicHelix is a Java Swing-based GUI frontend for SoundHelix.
* Copyright (C) 2018 UltrasonicMadness
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 only,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.ultrasonicmadness.madhelix.utils;
import java.io.File;
import java.util.ArrayList;
public class PathUtils {
// Get path to UltrasonicHelix.jar
public static String getMainJarPath() {
String mainJarPath = new File(
System.getProperty("java.class.path")
).getAbsolutePath();
return mainJarPath;
}
// Get path to directory containing UltrasonicHelix.jar
public static String getParentDirPath() {
String parentDirPath = new File(getMainJarPath()).getParent();
return parentDirPath;
}
// Get path to directory containing SoundHelix xml files.
public static String getStylesDirPath() {
String stylesDirPath = getParentDirPath() + File.separator + "styles";
return stylesDirPath;
}
// Get path to output directory for MIDI files.
public static String getMidiDirPath() {
String stylesDirPath = getParentDirPath() + File.separator + "midi";
return stylesDirPath;
}
// Get list of available SoundHelix styles
public static String[] getStyles() {
ArrayList<String> styleList = new ArrayList<>();
String[] fullFileList = new File(getStylesDirPath()).list();
try {
for (String fileName : fullFileList) {
// Only return files ending with the extension XML
if (fileName.substring(fileName.length() - 4).equals(".xml")) {
// Remove .xml from the end of the style names
styleList.add(
fileName.substring(0, fileName.length() - 4)
);
}
}
} catch (Exception e) {
System.err.println("Error loading styles");
}
// Convert ArrayList to standard array.
return styleList.toArray(new String[styleList.size()]);
}
}