Commit d7619e1
Resolve relative paths on Windows
Changed files (5)
modifieddodo.pymodifiedlibbirdfont/BirdFont.valamodifiedlibbirdfont/Font.valamodifiedlibbirdxml/Xml.valamodifiedscripts/bavala.py
Diff
@@ -99,7 +99,7 @@ libbird = Vala(src='libbirdfont', build='build', library='birdfont', so_version= 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() @@ -698,15 +698,15 @@ public static File get_child (File folder, string file_name) { // 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; }@@ -172,7 +172,8 @@ public class Font : GLib.Object { 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 @@ public class Font : GLib.Object { /** @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); } @@ -34,7 +34,7 @@ namespace Bird { * 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 @@ namespace Bird { * } * * 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"); * }@@ -145,7 +145,7 @@ class Vala(object): } - 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 @@ class Vala(object): + '-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 {