Skip to content

Commit

Permalink
Added argument 0 for changing path to equations file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrolin committed Feb 22, 2019
1 parent 6dcbb50 commit 9b7c887
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
Binary file modified LaTeX/dist/LaTeX.jar
Binary file not shown.
10 changes: 2 additions & 8 deletions LaTeX/src/latex/Latex.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
*/
public class Latex {

static String EQUATIONS_PATH = getDefaultPath() + "equations.xml";
static final char SEPARATOR = System.getProperty("user.dir").contains("/") ? '/' : '\\';
static String EQUATIONS_PATH = System.getProperty("user.dir") + Latex.SEPARATOR + "equations.xml";


public static TeXIcon textToTeXIcon(String math, int size) {
Expand All @@ -43,13 +44,6 @@ public static TeXIcon textToTeXIcon(String math){
return textToTeXIcon(math, 40);
}

private static String getDefaultPath() {
String defaultPath = System.getProperty("user.dir");
String pathSeparator = defaultPath.contains("/") ? "/" : "\\";
defaultPath += pathSeparator;
return defaultPath;
}

public static void writeEquations(ArrayList<String> classes, ArrayList<String> categories, ArrayList<Equation> equations) throws FileNotFoundException, XMLStreamException, IOException {
// OPEN
Files.write(Paths.get(EQUATIONS_PATH), Arrays.asList(""), Charset.forName("UTF-8"));
Expand Down
12 changes: 9 additions & 3 deletions LaTeX/src/latex/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ public class Main {

public static void main(String[] args) {
if(args.length > 0){
String newPath = args[0];
newPath = newPath.substring(0, newPath.length()-7) + "equations.xml";
Latex.EQUATIONS_PATH = newPath;
String str = args[0];
if(str.lastIndexOf(".") < 0){
if(str.charAt(str.length() - 1) != Latex.SEPARATOR){
str += Latex.SEPARATOR;
}
str += "equations.xml";
}
System.out.println(str);
Latex.EQUATIONS_PATH = str;
}
System.out.println("- " + Latex.EQUATIONS_PATH);
MainWindow window = new MainWindow();
Expand Down
Binary file modified LaTeX/store/LaTeX.jar
Binary file not shown.
Binary file removed LaTeX/store/MeX.exe
Binary file not shown.
1 change: 0 additions & 1 deletion LaTeX/store/equations.xml

This file was deleted.

0 comments on commit 9b7c887

Please sign in to comment.