Răsfoiți Sursa

convenience function for path extensions based on igl::pathinfo

Alec Jacobson 5 ani în urmă
părinte
comite
6e1ed534ce
2 a modificat fișierele cu 38 adăugiri și 0 ștergeri
  1. 9 0
      include/igl/extension.cpp
  2. 29 0
      include/igl/extension.h

+ 9 - 0
include/igl/extension.cpp

@@ -0,0 +1,9 @@
+#include "extension.h"
+#include "pathinfo.h"
+
+IGL_INLINE std::string igl::extension( const std::string & path)
+{
+  std::string d,b,e,f;
+  pathinfo(path,d,b,e,f);
+  return e;
+}

+ 29 - 0
include/igl/extension.h

@@ -0,0 +1,29 @@
+// This file is part of libigl, a simple c++ geometry processing library.
+//
+// Copyright (C) 2020 Alec Jacobson <[email protected]>
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_EXTENSION_H
+#define IGL_EXTENSION_H
+#include "igl_inline.h"
+
+#include <string>
+
+namespace igl
+{
+  //  Inputs:
+  //    path  path with an extension (path/to/foo.obj)
+  //  Returns extension without dot (obj)
+  //
+  //  See also: pathinfo, basename, dirname
+  IGL_INLINE std::string extension( const std::string & path);
+}
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "extension.cpp"
+#endif
+
+#endif
+