The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Add a suffix for SVG files with conflicting names.

These changes was commited to the Birdfont repository Thu, 16 Oct 2014 19:15:22 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Thu, 16 Oct 2014 19:15:22 +0000]

Updated Files

libbirdfont/ExportTool.vala
--- a/libbirdfont/ExportTool.vala +++ b/libbirdfont/ExportTool.vala @@ -121,6 +121,8 @@ File file; DataOutputStream os; string name; + string fn; + int i; name = glyph.get_name (); @@ -129,21 +131,18 @@ } svg_file = (!) f; - - if (svg_file.index_of (".svg") == -1) { - svg_file += ".svg"; - } - - file = File.new_for_path (svg_file); - + if (!(fd is Glyph)) { return; } try { - - if (file.query_exists ()) { - file.delete (); + i = 1; + fn = svg_file.replace (".svg", ""); + file = File.new_for_path (fn + ".svg"); + while (file.query_exists ()) { + file = File.new_for_path (fn + @"$i.svg"); + i++; } glyph_svg = export_current_glyph_to_string ();