The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Resolve relative paths on Windows

These changes was commited to the Birdfont repository Fri, 17 Oct 2014 14:19:44 +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>
Fri, 17 Oct 2014 14:19:44 +0000 (16:19 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Fri, 17 Oct 2014 14:19:44 +0000 (16:19 +0200)
commit d7619e1d6daa046015c01d516867cde773feab28
tree 0e53593bc21977f3d6a661366297d86351ae07d1
parent c43b1cd8976e179841a11742ca2e28364c58baaf
Resolve relative paths on Windows

dodo.py
libbirdfont/BirdFont.vala
libbirdfont/Font.vala
libbirdxml/Xml.vala
scripts/bavala.py
diff --git a/dodo.py b/dodo.py
--- a/dodo.py +++ b/dodo.py @@ -99,7 +99,7 @@ def task_libbirdfont(): yield libbird.gen_c(valac_options) yield libbird.gen_o(['-fPIC -I./build/', """-D 'GETTEXT_PACKAGE="birdfont"'"""]) - yield libbird.gen_so() + yield libbird.gen_so('-l birdxml') yield libbird.gen_ln()
--- a/libbirdfont/BirdFont.vala +++ b/libbirdfont/BirdFont.vala @@ -697,16 +697,16 @@ string n; // avoid drive letter problems on windows + + f = (!) folder.get_path (); + s = (BirdFont.win32) ? "\\" : "/"; n = file_name; if (unlikely (BirdFont.win32 && file_name.index_of ("\\") != -1)) { - warning ("File name contains path separator."); + warning (@"File name contains path separator: $file_name, Directory: $f"); n = n.substring (n.last_index_of ("\\")).replace ("\\", ""); } - - f = (!) folder.get_path (); - s = (BirdFont.win32) ? "\\" : "/"; - + if (!f.has_suffix (s)) { f += s; }
--- a/libbirdfont/Font.vala +++ b/libbirdfont/Font.vala @@ -172,7 +172,8 @@ if (font_file != null) { fn = (!) font_file; - if (fn.index_of ("\\") != -1) { // assume only absolute paths are used on windows + // assume only absolute paths are used on windows + if (BirdFont.win32) { return fn; } else { file = File.new_for_path (fn); @@ -212,12 +213,18 @@ /** @return an absolute path to the font folder. */ public File get_folder () { string p = get_folder_path (); - File file = File.new_for_path (p); + File fp = File.new_for_path (p); - if (p.index_of ("\\") == -1 && !p.has_prefix ("/")) { - p = (!) file.resolve_relative_path ("").get_path (); + if (BirdFont.win32) { + if (p.index_of (":\\") == -1) { + p = (!) fp.resolve_relative_path ("").get_path (); + } + } else { + if (!p.has_prefix ("/")) { + p = (!) fp.resolve_relative_path ("").get_path (); + } } - + return File.new_for_path (p); }
--- a/libbirdxml/Xml.vala +++ b/libbirdxml/Xml.vala @@ -34,7 +34,7 @@ * Tag root; * XmlParser parser; * - * parser = new XmlParser ("""<tag1><tag2 attribute1=""/></tag1>""); + * parser = new XmlParser ("""<tag1><tag2 attribute1=""/></tag1>"""); * * if (parser.validate ()) { * root = parser.get_root_tag (); @@ -54,7 +54,8 @@ * } * * void print_attributes (Tag tag) { - * foreach (Attribute attribute in tag.get_attributes ()) { + * Attributes attributes = tag.get_attributes (); + * foreach (Attribute attribute in attributes) { * print (attribute.get_name ()"); * print ("\n"); * }
--- a/scripts/bavala.py +++ b/scripts/bavala.py @@ -145,7 +145,7 @@ } - def gen_so(self): + def gen_so(self, generated_libs = None): """generate ".so" lib file""" def compile_cmd(conf, libs): obj_glob = join(self.build, self.src, '*.o') @@ -153,7 +153,12 @@ + '-Wl,-soname,' + self.so_name + ' ' + obj_glob + ' -o ' + self.so ] + flags = [conf[l].strip() for l in libs] + + if generated_libs: + flags += [generated_libs] + return cmd(config.CC, opts, flags) return {