MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / fileOpenDialog

Method fileOpenDialog

examples/OpenGLWindow/X11OpenGLWindow.cpp:1173–1196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1171#include <stdio.h>
1172
1173int X11OpenGLWindow::fileOpenDialog(char* filename, int maxNameLength)
1174{
1175 int len = 0;
1176 FILE* output = popen("zenity --file-selection --file-filter=\"*.urdf\" --file-filter=\"*.sdf\" --file-filter=\"*.obj\" --file-filter=\"*.*\"", "r");
1177 if (output)
1178 {
1179 while (fgets(filename, maxNameLength - 1, output) != NULL)
1180 {
1181 len = strlen(filename);
1182 if (len > 0)
1183 {
1184 filename[len - 1] = 0;
1185 printf("file open (length=%d) = %s\n", len, filename);
1186 }
1187 }
1188 pclose(output);
1189 }
1190 else
1191 {
1192 printf("Error: fileOpenDialog no popen output, perhaps install zenity?\n");
1193 }
1194 MyXRaiseWindow(m_data->m_dpy, m_data->m_win);
1195 return len;
1196}
1197#endif

Callers 1

fileOpenCallbackFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected