]> git.tdb.fi Git - builder.git/blobdiff - source/tar.cpp
Converted from iostreams to mspio
[builder.git] / source / tar.cpp
index da579250a15654b978cda94eef621af1afbe319e..0b61b39b85cd4567b8eaf139ee29fb89958d2a53 100644 (file)
@@ -6,6 +6,7 @@ Distributed under the LGPL
 */
 
 #include <iostream>
+#include <msp/io/file.h>
 #include <msp/path/utils.h>
 #include "builder.h"
 #include "sourcepackage.h"
@@ -40,7 +41,7 @@ void Tar::Worker::main()
        const Path &pkg_src=tar.tarball.get_package()->get_source();
        Path basedir=splitext(basename(tar.tarball.get_name())).base;
 
-       ofstream out(tar.tarball.get_name().c_str());
+       IO::File out(tar.tarball.get_name(), IO::M_WRITE);
        const TargetList &deps=tar.tarball.get_depends();
        for(TargetList::const_iterator i=deps.begin(); i!=deps.end(); ++i)
        {
@@ -73,11 +74,10 @@ void Tar::Worker::main()
                buf[155]=0;
 
                out.write(buf, 512);
-               ifstream in((*i)->get_name().c_str());
+               IO::File in((*i)->get_name());
                for(int j=0; j<st.st_size; j+=4096)
                {
-                       in.read(buf, 4096);
-                       unsigned len=in.gcount();
+                       unsigned len=in.read(buf, 4096);
                        len+=((~len)+1)&0777;
                        out.write(buf, len);
                }