mirror of https://github.com/jlizier/jidt
In AutoAnalyser escaping data filenames when they are written to the generated code. This is important for windows filenames. Am not sure why it didn't come up before as an issue though.
This commit is contained in:
parent
f902aa69dd
commit
3bfbaa7ad3
|
@ -864,9 +864,10 @@ public abstract class AutoAnalyser extends JFrame
|
|||
|
||||
// Code to read in data:
|
||||
String loadDataComment = "0. Load/prepare the data:\n";
|
||||
String filenameAsEscapedString = dataFile.getAbsolutePath().replaceAll("\\", "\\\\");
|
||||
// 1. Java
|
||||
javaCode.append(" // " + loadDataComment);
|
||||
javaCode.append(" String dataFile = \"" + dataFile.getAbsolutePath() + "\";\n");
|
||||
javaCode.append(" String dataFile = \"" + filenameAsEscapedString + "\";\n");
|
||||
javaCode.append(" ArrayFileReader afr = new ArrayFileReader(dataFile);\n");
|
||||
if (selectedCalcType.equalsIgnoreCase(CALC_TYPE_DISCRETE)) {
|
||||
javaCode.append(" int[][] data = afr.getInt2DMatrix();\n");
|
||||
|
@ -901,9 +902,9 @@ public abstract class AutoAnalyser extends JFrame
|
|||
// 2. Python
|
||||
pythonCode.append("# " + loadDataComment);
|
||||
if (selectedCalcType.equalsIgnoreCase(CALC_TYPE_DISCRETE)) {
|
||||
pythonCode.append("dataRaw = readIntsFile.readIntsFile(\"" + dataFile.getAbsolutePath() + "\")\n");
|
||||
pythonCode.append("dataRaw = readIntsFile.readIntsFile(\"" + filenameAsEscapedString + "\")\n");
|
||||
} else {
|
||||
pythonCode.append("dataRaw = readFloatsFile.readFloatsFile(\"" + dataFile.getAbsolutePath() + "\")\n");
|
||||
pythonCode.append("dataRaw = readFloatsFile.readFloatsFile(\"" + filenameAsEscapedString + "\")\n");
|
||||
}
|
||||
pythonCode.append("# As numpy array:\n");
|
||||
pythonCode.append("data = numpy.array(dataRaw)\n");
|
||||
|
@ -929,7 +930,7 @@ public abstract class AutoAnalyser extends JFrame
|
|||
}
|
||||
// 3. Matlab
|
||||
matlabCode.append("% " + loadDataComment);
|
||||
matlabCode.append("data = load('" + dataFile.getAbsolutePath() + "');\n");
|
||||
matlabCode.append("data = load('" + filenameAsEscapedString + "');\n");
|
||||
if (! allCombosCheckBox.isSelected()) {
|
||||
matlabCode.append("% Column indices start from 1 in Matlab:\n");
|
||||
if (selectedCalcType.equalsIgnoreCase(CALC_TYPE_DISCRETE)) {
|
||||
|
|
Loading…
Reference in New Issue