dirname.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2018 Alec Jacobson <alecjacobson@gmail.com>
  4. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  5. //
  6. // This Source Code Form is subject to the terms of the Mozilla Public License
  7. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  8. // obtain one at http://mozilla.org/MPL/2.0/.
  9. #ifndef IGL_DIRNAME_H
  10. #define IGL_DIRNAME_H
  11. #include "igl_inline.h"
  12. #include <string>
  13. namespace igl
  14. {
  15. // Function like PHP's dirname: /etc/passwd --> /etc,
  16. // Input:
  17. // path string containing input path
  18. // Returns string containing dirname (see php's dirname)
  19. //
  20. // See also: basename, pathinfo
  21. //
  22. // **Note:** This function will have undefined behavior if **file names** in
  23. // the path contain \ and / characters. This function interprets \ and / as
  24. // file path separators.
  25. IGL_INLINE std::string dirname(const std::string & path);
  26. }
  27. #ifndef IGL_STATIC_LIBRARY
  28. # include "dirname.cpp"
  29. #endif
  30. #endif