The Birdfont Source Code


All Repositories / birdfont.git / commit – 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
author Johan Mattsson <johan.mattsson.m@gmail.com>
Thu, 16 Oct 2014 19:15:22 +0000 (21:15 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Thu, 16 Oct 2014 19:15:22 +0000 (21:15 +0200)
commit a0455e26d029a5bf2470e73af89226b36d3efd1f
tree f777eeb8cc480dea7998c8cadda5cf62fd278d9c
parent 0335b5b36740e92e20a5ded18aabf433d3f1ae9a
Add a suffix for SVG files with conflicting names.

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 ();