如何在C ++ / gtkmm下将相对路径转换为绝对路径?

时间:2017-01-04 14:23:59

标签: c++ gtk gtkmm

如何在C ++和gtk下将相对路径转换为绝对路径?

1 个答案:

答案 0 :(得分:1)

// For C++ with Gnome Gtkmm3 libraries
#include <string>
#include <glibmm.h>
#include <giomm.h>

using namespace std;

string PathRel2Abs(string relpath) {
  Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(relpath);
  return file->get_path();
}