Mercurial > projects > mde
comparison mde/file/ssi.d @ 114:b16a534f5302
Changes for tango r4201. Added override keyword in a lot of places.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 19 Dec 2008 15:15:06 +0000 |
parents | ac1e3fd07275 |
children |
comparison
equal
deleted
inserted
replaced
113:9824bee909fd | 114:b16a534f5302 |
---|---|
26 import tango.io.UnicodeFile; | 26 import tango.io.UnicodeFile; |
27 | 27 |
28 S read(S) (FilePath path) { | 28 S read(S) (FilePath path) { |
29 char[] buf; | 29 char[] buf; |
30 try { | 30 try { |
31 scope file = new UnicodeFile!(char) (path, Encoding.Unknown); // from BOM or use UTF-8 | 31 scope file = new UnicodeFile!(char) (path.toString, Encoding.Unknown); // from BOM or use UTF-8 |
32 buf = cast(char[]) file.read; | 32 buf = cast(char[]) file.read; |
33 } catch (Exception e) { | 33 } catch (Exception e) { |
34 throw new ioException ("While reading \""~path.toString~"\": "~e.msg); | 34 throw new ioException ("While reading \""~path.toString~"\": "~e.msg); |
35 } | 35 } |
36 | 36 |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 void write(S) (FilePath path, S content) { | 48 void write(S) (FilePath path, S content) { |
49 try { | 49 try { |
50 scope file = new UnicodeFile!(char) (path, Encoding.UTF_8N); | 50 scope file = new UnicodeFile!(char) (path.toString, Encoding.UTF_8N); |
51 file.write ("mdessi00\n"~serialize(content), true); | 51 file.write ("mdessi00\n"~serialize(content), true); |
52 } catch (Exception e) { | 52 } catch (Exception e) { |
53 throw new ioException ("Unable to write file "~path.toString~": "~e.msg); | 53 throw new ioException ("Unable to write file "~path.toString~": "~e.msg); |
54 } | 54 } |
55 } | 55 } |