Changeset 796 for trunk/lib


Ignore:
Timestamp:
Jul 1, 2009, 2:55:02 AM (12 years ago)
Author:
Peter Johansson
Message:

added a function mkdir_p(1)

Location:
trunk/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/utility.cc

    r795 r796  
    33/*
    44  Copyright (C) 2006, 2007, 2009 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2008 Peter Johansson
     5  Copyright (C) 2008, 2009 Peter Johansson
    66
    77  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    186186
    187187
     188  void mkdir_p(const std::string& dir)
     189  {
     190    std::string mother = directory_name(dir);
     191    if (!node_exist(mother))
     192      mkdir_p(mother);
     193    if (!node_exist(dir))
     194      mkdir(dir);
     195  }
     196
     197
    188198  bool node_exist(const std::string& path)
    189199  {
  • trunk/lib/utility.h

    r795 r796  
    77  Copyright (C) 2005 Peter Johansson
    88  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
     9  Copyright (C) 2009 Peter Johansson
    910
    1011  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    135136  ///
    136137  void mkdir(const std::string& dir);
     138
     139  ///
     140  /// Create directory \a dir and parents directories if needed. No
     141  /// error if \a dir already exists.
     142  ///
     143  void mkdir_p(const std::string& dir);
    137144
    138145  ///
Note: See TracChangeset for help on using the changeset viewer.