Mercurial > projects > dynamin
comparison dynamin/core/file.d @ 106:acdbb30fee7e
Port to D2.
Most of the effort was dealing with immutable and const.
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Mon, 17 Dec 2012 23:41:50 -0600 |
parents | 73060bc3f004 |
children |
comparison
equal
deleted
inserted
replaced
105:97997a544ac0 | 106:acdbb30fee7e |
---|---|
12 | 12 |
13 import dynamin.core.string; | 13 import dynamin.core.string; |
14 import tango.io.device.File; | 14 import tango.io.device.File; |
15 import tango.io.UnicodeFile; | 15 import tango.io.UnicodeFile; |
16 | 16 |
17 ubyte[] readFileBytes(string file) { | 17 ubyte[] readFileBytes(cstring file) { |
18 return cast(ubyte[])File.get(file); | 18 return cast(ubyte[])File.get(file); |
19 //scope f = new File(file); | 19 //scope f = new File(file); |
20 //return cast(ubyte[])f.read(); | 20 //return cast(ubyte[])f.read(); |
21 } | 21 } |
22 string readFileText(string file) { | 22 mstring readFileText(cstring file) { |
23 scope f = new UnicodeFile!(char)(file, Encoding.UTF_8); | 23 scope f = new UnicodeFile!(char)(file, Encoding.UTF_8); |
24 return f.read(); | 24 return f.read(); |
25 } | 25 } |
26 | 26 |