]> git.tdb.fi Git - builder.git/blobdiff - source/tar.cpp
Add missing includes
[builder.git] / source / tar.cpp
index 532b4a73f2ffdb23c553fce21cb1e8f8f8597370..d43a5b0cbb24e0e49dc384591f9300201e6a58ff 100644 (file)
@@ -6,6 +6,8 @@ Distributed under the LGPL
 */
 
 #include <iostream>
+#include <cstring>
+#include <msp/io/file.h>
 #include <msp/path/utils.h>
 #include "builder.h"
 #include "sourcepackage.h"
@@ -37,10 +39,10 @@ Tar::Worker::Worker(Tar &t):
 
 void Tar::Worker::main()
 {
-       const Path::Path &pkg_src=tar.tarball.get_package()->get_source();
-       Path::Path basedir=Path::splitext(Path::basename(tar.tarball.get_name())).base;
+       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)
        {
@@ -57,8 +59,7 @@ void Tar::Worker::main()
 
                memcpy(buf, rel_path.data(), rel_path.size());
 
-               struct stat st;
-               Path::stat((*i)->get_name(), st);
+               struct stat st=stat((*i)->get_name());
                store_number(buf+100, st.st_mode, 7);
                store_number(buf+108, st.st_uid, 7);
                store_number(buf+116, st.st_gid, 7);
@@ -74,11 +75,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);
                }