+static bool exportmeshgraph(const char* path)
+{
+ struct stat ps;
+ int psr = stat(path, &ps);
+
+ if(psr == 0 || errno != ENOENT)
+ {
+ if(psr == -1)
+ { perror("stat"); }
+ else
+ { fprintf(stderr, "%s exists already\n", path); }
+
+ return false;
+ }
+
+ FILE* stream = fopen(path, "w");
+
+ if(!stream)
+ {
+ perror("stream");
+ return false;
+ }
+
+ if(!devtool_export_json_all_edges_state(mesh[0], stream))
+ {
+ fclose(stream);
+ fprintf(stderr, "could not export graph\n");
+ return false;
+ }
+
+ fclose(stream);
+ return true;
+}
+