From c09cd7512491cee1e82c1ad8128ce9fd4bc3f79b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 22 Sep 2017 23:32:28 +0200 Subject: Initial modularization with both Clang and VC hacks Note: gave up on VC about half way though. --- libbutl/path.cxx | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) (limited to 'libbutl/path.cxx') diff --git a/libbutl/path.cxx b/libbutl/path.cxx index c1ede40..bbc4754 100644 --- a/libbutl/path.cxx +++ b/libbutl/path.cxx @@ -2,7 +2,9 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include +#ifndef __cpp_modules +#include +#endif #ifdef _WIN32 # include @@ -21,18 +23,37 @@ # include // strlen(), strcpy() # include // stat(), S_IS* # include // stat - -# include #endif -#include #include + +#ifndef __cpp_lib_modules +#include +#include +#include + +#include #include // strcpy() +#endif -#include +#ifdef __cpp_modules +module butl.path; -#include // throw_*_error() -#include +// Only imports additional to interface. +#ifdef __clang__ +#ifdef __cpp_lib_modules +import std.core; +#endif +#endif + +import butl.utility; // throw_*_error() +import butl.process; // process::current_id() +#else +#include +#include +#endif + +#include #ifndef _WIN32 # ifndef PATH_MAX @@ -88,9 +109,11 @@ namespace butl // one of the drive requires the trailing directory separator to be // present. // - string_type const& d (!root (s) - ? s - : string_type (s + directory_separator)); + string_type const& d ( + !root (s) + ? s + //@@ MOD VC ADL does not seem to kick in for some reason... + : string_type (std::operator+ (s, directory_separator))); if (_chdir (d.c_str ()) != 0) throw_generic_error (errno); @@ -168,7 +191,7 @@ namespace butl #endif } - static atomic temp_name_count; + static atomic temp_name_count (0); template <> LIBBUTL_SYMEXPORT path_traits::string_type path_traits:: -- cgit v1.1