OSDN Git Service

Correct problem parsing notes where carriage returns did not separate some XML lines...
[neighbornote/NeighborNote.git] / src / cx / fbn / nevernote / utilities / FileUtils.java
1 package cx.fbn.nevernote.utilities;
2
3 import java.io.File;
4
5 /**
6  * @author Nick Clarke
7  *
8  */
9 public final class FileUtils {
10
11     private FileUtils() {}
12
13     public static String toFileURLString(File file) {
14         // NFC TODO: is it safe to use file.toURI().toURL() instead?
15         String prefix = (System.getProperty("os.name").contains("Windows") ? "file:///" : "file://");
16         return prefix + toForwardSlashedPath(file.getAbsolutePath());
17     }
18
19     public static String toForwardSlashedPath(String path) {
20         return path.replace('\\', '/');
21     }
22   
23 }