- filename = "/levels/" + name + "/";
-
- FileSystem::fcreatedir(filename.c_str());
- filename = std::string(st_dir) + "/levels/" + name + "/info";
- if(!FileSystem::fwriteable(filename.c_str()))
- filename = datadir + "/levels/" + name + "/info";
- if(FileSystem::fwriteable(filename.c_str()))
- {
- fi = fopen(filename.c_str(), "w");
- if (fi == NULL)
- {
- perror(filename.c_str());
- }
-
- /* Write header: */
- fprintf(fi,";; SuperTux-Level-Subset\n");
- fprintf(fi,"(supertux-level-subset\n");
-
- /* Save title info: */
- fprintf(fi," (title \"%s\")\n", title.c_str());
-
- /* Save the description: */
- fprintf(fi," (description \"%s\")\n", description.c_str());
-
- /* Save the hide from Contrbis menu boolean: */
- fprintf(fi," (hide-from-contribs \"%s\")\n", hide_from_contribs ? "#t" : "#f");
-
- fprintf( fi,")");
- fclose(fi);
- }
+ std::string filename = name + "/info";
+ lisp::Writer writer(filename);
+
+ writer.start_list("supertux-level-subset");
+ writer.write_string("title", title);
+ writer.write_string("description", description);
+ writer.write_bool("hide-from-contribs", hide_from_contribs);
+ writer.end_list("supertux-level-subset");