+static void world_write_preview( addon_reg *reg, pointcloud_buffer *pcbuf ){
+ if( reg->alias.workshop_id ) return;
+
+ /*
+ * FIXME: BUG: cannot correctly handle workshop because there is a stalling
+ * call below, which deadlocks the scene upload. TODO: improve the async
+ * stack to handle out of order execution. MAYBE
+ */
+
+ char path_buf[4096];
+ vg_str path;
+ vg_strnull( &path, path_buf, 4096 );
+
+ addon_get_content_folder( reg, &path );
+ vg_strcat( &path, "/preview.bin" );
+
+ if( !vg_strgood( &path ) ) vg_fatal_error( "Path too long\n" );
+ FILE *fp = fopen( path_buf, "wb" );
+ if( !fp ) vg_fatal_error( "Cannot open '%s' for writing\n", path_buf );
+
+ fwrite( pcbuf, sizeof(struct pointcloud_buffer) +
+ sizeof(struct pointcloud_vert)*pcbuf->count, 1, fp );
+ fclose( fp );
+ vg_info( "written %s\n", path_buf );
+}
+