Tag Archives: line break

Cross platform fun

While debugging some test problems with the T2 code I discovered some issues between OSX and Windows regards file paths and line breaks.  Seems that instead of just

inputs.put(“fileUrl”, LocalworkerTranslator.class.getResource( “/AAC4_HUMAN.sp”).getFile());

you have to ensure that the absolute path is correct by doing

URI uri = LocalworkerTranslator.class.getResource(“/AAC4_HUMAN.sp”) .toURI();

File newFile = new File(uri);

inputs.put(“fileUrl”, newFile.getAbsolutePath());

Also, you can’t expect checks for “\n” style line breaks to work in Windows because they insert things like “\r\n” instead.  So , you should use System.getProperty(“line.separator”) instead.