file_dialog.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Daniele Panozzo <daniele.panozzo@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_FILE_DIALOG_H
  9. #define IGL_FILE_DIALOG_H
  10. #include <stdio.h>
  11. #include <string>
  12. #ifdef _WIN32
  13. #include <Commdlg.h>
  14. #endif
  15. namespace igl
  16. {
  17. // Returns a string with a path to an existing file
  18. // The string is returned empty if no file is selected
  19. // (on Linux machines, it assumes that Zenity is installed)
  20. //
  21. // Usage:
  22. // std::string str = get_open_file_path();
  23. std::string IGL_INLINE file_dialog_open();
  24. // Returns a string with a path to a new/existing file
  25. // The string is returned empty if no file is selected
  26. // (on Linux machines, it assumes that Zenity is installed)
  27. //
  28. // Usage:
  29. // char buffer[FILE_DIALOG_MAX_BUFFER];
  30. // get_save_file_path(buffer);
  31. std::string IGL_INLINE file_dialog_save();
  32. }
  33. #ifdef IGL_HEADER_ONLY
  34. # include "file_dialog.cpp"
  35. #endif
  36. #endif