From 8b98a6b3fae40487ac529a7118865df6a71159ee Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 22 Jul 2017 17:43:09 +0200 Subject: Implement detection of ignorable changes (whitespaces, comments) --- build2/test/script/builtin.cxx | 43 +++++------------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) (limited to 'build2/test') diff --git a/build2/test/script/builtin.cxx b/build2/test/script/builtin.cxx index 2a8150d..ca47ad2 100644 --- a/build2/test/script/builtin.cxx +++ b/build2/test/script/builtin.cxx @@ -4,12 +4,6 @@ #include -#ifndef _WIN32 -# include -#else -# include -#endif - #include #include #include @@ -1505,38 +1499,11 @@ namespace build2 try { - if (file_exists (p)) - { - // Set the file access and modification times to the current - // time. Note that we don't register (implicit) cleanup for an - // existing path. - // -#ifndef _WIN32 - if (utime (p.string ().c_str (), nullptr) == -1) -#else - if (_utime (p.string ().c_str (), nullptr) == -1) -#endif - throw_generic_error (errno); - } - else if (!entry_exists (p)) - { - // Create the file. Assume the file access and modification - // times are set to the current time automatically. - // - try - { - fdopen (p, fdopen_mode::out | fdopen_mode::create); - } - catch (const io_error& e) - { - error () << "cannot create file '" << p << "': " << e; - } - - if (cleanup) - sp.clean ({cleanup_type::always, p}, true); - } - else - error () << "'" << p << "' exists and is not a file"; + // Note that we don't register (implicit) cleanup for an + // existing path. + // + if (touch_file (p) && cleanup) + sp.clean ({cleanup_type::always, p}, true); } catch (const system_error& e) { -- cgit v1.1