obj.name = 'libsub'
obj.target = 'sub'
- obj.uselib = 'CXML'
+ obj.uselib = 'CXML BOOST_FILESYSTEM'
obj.export_includes = ['.']
obj.source = """
colour.cc
BOOST_AUTO_TEST_CASE (dcp_to_stl_text_test)
{
+ using boost::filesystem::path;
+
if (private_test.empty ()) {
return;
}
- string const p = private_test + "/fd586c30-6d38-48f2-8241-27359acf184c_sub.xml";
+ path p = private_test / "fd586c30-6d38-48f2-8241-27359acf184c_sub.xml";
ifstream f (p.c_str ());
sub::DCPReader r (f);
- string const q = "build/test/fd586c30-6d38-48f2-8241-27359acf184c_sub.stl";
+ path const q = path ("build") / path ("test") / path ("fd586c30-6d38-48f2-8241-27359acf184c_sub.stl");
ofstream g (q.c_str ());
sub::STLTextWriter w (r.subtitles (), 72 * 11, 24, g);
- string const c = private_test + "/fd586c30-6d38-48f2-8241-27359acf184c_sub.stl";
+ path const c = private_test / "fd586c30-6d38-48f2-8241-27359acf184c_sub.stl";
g.close ();
check_text (q, c);
}
return;
}
- string p = private_test + "/Vampire_Academy_24fps_Reel_6_DE_FR.stl";
- ifstream f (p.c_str ());
+ boost::filesystem::path p = private_test / "Vampire_Academy_24fps_Reel_6_DE_FR.stl";
+ ifstream f (p.string().c_str ());
sub::STLBinaryReader r (f);
}
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE libsub_test
#include <boost/test/unit_test.hpp>
+#include <boost/filesystem.hpp>
#include <fstream>
#include <string>
using std::ifstream;
using std::getline;
-string private_test;
+boost::filesystem::path private_test;
struct TestConfig
{
BOOST_GLOBAL_FIXTURE (TestConfig);
void
-check_text (string a, string b)
+check_text (boost::filesystem::path a, boost::filesystem::path b)
{
- if (access (a.c_str(), F_OK) == -1) {
+ if (!boost::filesystem::exists (a)) {
cerr << "File not found: " << a << "\n";
}
- if (access (b.c_str(), F_OK) == -1) {
+ if (!boost::filesystem::exists (b)) {
cerr << "File not found: " << b << "\n";
}
- BOOST_CHECK_EQUAL (access (a.c_str(), F_OK), 0);
+ BOOST_CHECK (boost::filesystem::exists (a));
+ BOOST_CHECK (boost::filesystem::exists (b));
ifstream p (a.c_str ());
ifstream q (b.c_str ());
*/
#include <string>
+#include <boost/filesystem.hpp>
-using std::string;
+extern boost::filesystem::path private_test;
-extern string private_test;
-
-void check_text (std::string a, std::string b);
+void check_text (boost::filesystem::path a, boost::filesystem::path b);
*/
#include <map>
+#include <boost/filesystem.hpp>
#include <getopt.h>
#include "reader_factory.h"
#include "reader.h"
exit (EXIT_FAILURE);
}
- if (access (argv[optind], F_OK) == -1) {
+ if (!boost::filesystem::exists (argv[optind])) {
cerr << argv[0] << ": file " << argv[optind] << " not found.\n";
exit (EXIT_FAILURE);
}
okmsg='yes',
errmsg='too old\nPlease install boost version 1.45 or higher.')
+ conf.check_cxx(fragment = """
+ #include <boost/filesystem.hpp>\n
+ int main() { boost::filesystem::copy_file ("a", "b"); }\n
+ """,
+ msg = 'Checking for boost filesystem library',
+ libpath = '/usr/local/lib',
+ lib = ['boost_filesystem', 'boost_system'],
+ uselib_store = 'BOOST_FILESYSTEM')
+
conf.recurse('test')
def build(bld):