Mercurial > projects > mde
diff mde/mergetag/Writer.d @ 67:108d123238c0
Changes to work with tango r3700 (post 0.99.6).
Changes to logging.
Replaced many uses of PathView with FilePath.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Thu, 03 Jul 2008 12:40:31 +0100 |
parents | 611f7b9063c6 |
children |
line wrap: on
line diff
--- a/mde/mergetag/Writer.d Sun Jun 29 15:40:37 2008 +0100 +++ b/mde/mergetag/Writer.d Thu Jul 03 12:40:31 2008 +0100 @@ -90,12 +90,14 @@ * Throws: * MTFileFormatException if unable to determine writing format or use requested format. */ -IWriter makeWriter (char[] path, DataSet dataset = null, WriterMethod method = WriterMethod.FromExtension) { +//FIXME: separate functions for separate functionality, like in Reader? +IWriter makeWriter (char[] path, DataSet dataset = null, + WriterMethod method = WriterMethod.FromExtension) { if (method == WriterMethod.FromExtension) { - PathView fpath = new FilePath (path); - - if (fpath.ext == "mtt") return new MTTWriter (fpath, dataset); - else if (fpath.ext == "mtb") return new MTBWriter (fpath, dataset); + if (path.length > 4 && path[$-4..$] == ".mtt") + return new MTTWriter (path, dataset); + else if (path.length > 4 && path[$-4..$] == ".mtb") + return new MTBWriter (path, dataset); else { logger.error ("Unable to determine writing format: text or binary"); throw new MTFileFormatException; @@ -143,7 +145,7 @@ /* The container where data is written from. */ DataSet _dataset; - PathView _path; + char[] _path; //END DATA //BEGIN CTOR / DTOR @@ -152,16 +154,12 @@ * The call doesn't actually execute any code so cannot fail (unless out of memory). * * Params: - * path = The name or FilePath of the file to open. + * path = The name of the file to open. * Standard extensions are .mtt and .mtb for text and binary files respectively. * dataset_ = If null create a new DataSet, else use existing DataSet *dataset_ and merge read * data into it. */ public this (char[] path, DataSet ds = null) { - this (new FilePath (path), ds); - } - /** ditto */ - public this (PathView path, DataSet ds = null) { _path = path; _dataset = ds; } @@ -235,9 +233,6 @@ */ class MTBWriter : IWriter { public this (char[] path, DataSet ds = null) { - this (new FilePath (path), ds); - } - public this (PathView path, DataSet ds = null) { throw new MTNotImplementedException; /+_path = path;