testmycode / tmc-langs

TMC language support framework
2 stars 17 forks source link

Zipper tests fail on Windows #75

Closed cxcorp closed 7 years ago

cxcorp commented 7 years ago

On Windows, zipperDetectectsAndObeysTmcnosubmitFiles and zipperCorrectlyZipsFolderWithFilesAndSubFolders from fi.helsinki.cs.tmc.langs.io.zip.StudentFileAwareZipperTest fail because some of the zip entry names have their forward slashes turned into backslashes. For example, tmcnosubmit_test_case/allowed/ gets changed into tmcnosubmit_test_case\allowed/.

Honestly though, I don't quite understand why the zip files' entries are checked via a hashmap .Contains(filename)-kind of check. Wouldn't ZipFile.equals work?

cxcorp commented 7 years ago

Probable culprit: https://github.com/testmycode/tmc-langs/blob/master/tmc-langs-framework/src/main/java/fi/helsinki/cs/tmc/langs/io/zip/StudentFileAwareZipper.java#L112

    String name = projectPath.getParent().relativize(currentPath).toString();

    if (Files.isDirectory(currentPath)) {
        log.trace("{} is a directory", currentPath);
        // Must be "/", can not be replaces with File.separator
        name += "/";
    }

I'm guessing Path.toString outputs platform-specific slashes.