# # # patch "paths.cc" # from [e69921ea0792ae986418a4c8a0b70645121ec0ae] # to [7c27cc4b68ddf1b7e376ad6a662bce78d1312155] # # patch "paths.hh" # from [89889a9efd53a3874b4b2f15f2a7d6024edebfcf] # to [e81d1f0e7efdbff539b8b92f04ad357770130fd4] # # patch "roster.cc" # from [4f3c91c82adf9cdfd2062acf739ca90b61b180db] # to [c7198e45fd020f37d1d2fa10f203bf4e9982a1bc] # # patch "roster.hh" # from [0647777b7cab5a2c17419998351f049eadc706d5] # to [9ec5d3bbd5751f987a7591a3d577002a627a36e3] # ============================================================ --- paths.cc e69921ea0792ae986418a4c8a0b70645121ec0ae +++ paths.cc 7c27cc4b68ddf1b7e376ad6a662bce78d1312155 @@ -469,6 +469,26 @@ } /////////////////////////////////////////////////////////////////////////// +// utility +/////////////////////////////////////////////////////////////////////////// + +void +dirname_basename(split_path const & sp, + split_path & dirname, path_component & basename) +{ + I(!sp.empty()); + // L(FL("dirname_basename('%s' [%d components],...)\n") % file_path(sp) % sp.size()); + split_path::const_iterator penultimate = sp.begin() + (sp.size()-1); + dirname = split_path(sp.begin(), penultimate); + basename = *penultimate; + if (dirname.empty()) + { + // L(FL("basename %d vs. null component %d\n") % basename % the_null_component); + I(null_name(basename)); + } +} + +/////////////////////////////////////////////////////////////////////////// // workspace (and path root) handling /////////////////////////////////////////////////////////////////////////// ============================================================ --- paths.hh 89889a9efd53a3874b4b2f15f2a7d6024edebfcf +++ paths.hh e81d1f0e7efdbff539b8b92f04ad357770130fd4 @@ -235,6 +235,9 @@ system_path operator /(std::string const & to_append) const; }; +void +dirname_basename(split_path const & sp, + split_path & dirname, path_component & basename); void save_initial_path(); ============================================================ --- roster.cc 4f3c91c82adf9cdfd2062acf739ca90b61b180db +++ roster.cc c7198e45fd020f37d1d2fa10f203bf4e9982a1bc @@ -305,23 +305,7 @@ return *this; } -void -dirname_basename(split_path const & sp, - split_path & dirname, path_component & basename) -{ - I(!sp.empty()); - // L(FL("dirname_basename('%s' [%d components],...)\n") % file_path(sp) % sp.size()); - split_path::const_iterator penultimate = sp.begin() + (sp.size()-1); - dirname = split_path(sp.begin(), penultimate); - basename = *penultimate; - if (dirname.empty()) - { - // L(FL("basename %d vs. null component %d\n") % basename % the_null_component); - I(null_name(basename)); - } -} - struct dfs_iter { ============================================================ --- roster.hh 0647777b7cab5a2c17419998351f049eadc706d5 +++ roster.hh 9ec5d3bbd5751f987a7591a3d577002a627a36e3 @@ -32,11 +32,6 @@ typedef boost::shared_ptr file_t; typedef boost::shared_ptr dir_t; -// FIXME: perhaps move this to paths.{cc,hh} -void -dirname_basename(split_path const & sp, - split_path & dirname, path_component & basename); - node_id const the_null_node = 0; inline bool