Clone in a terminal:
Commit d7619e1
Johan Mattsson - 2014-10-17T14:19:44+00:00
d7619e1d6daa046015c01d516867cde773feab28johan.mattsson.m@gmail.com

Resolve relative paths on Windows

Changed files (5)

Diff

diff --git a/dodo.py b/dodo.pyindex 6cb6475..b94d619 100644--- a/dodo.py+++ b/dodo.py@@ -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()  diff --git a/libbirdfont/BirdFont.vala b/libbirdfont/BirdFont.valaindex 64a662c..fad7ab5 100644--- a/libbirdfont/BirdFont.vala+++ b/libbirdfont/BirdFont.vala@@ -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; 	}diff --git a/libbirdfont/Font.vala b/libbirdfont/Font.valaindex f099a37..d86aeb7 100644--- a/libbirdfont/Font.vala+++ b/libbirdfont/Font.vala@@ -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); 	} 	diff --git a/libbirdxml/Xml.vala b/libbirdxml/Xml.valaindex 8d7ebca..0667169 100644--- a/libbirdxml/Xml.vala+++ b/libbirdxml/Xml.vala@@ -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");  * 	}diff --git a/scripts/bavala.py b/scripts/bavala.pyindex 9a9efc1..1328003 100644--- a/scripts/bavala.py+++ b/scripts/bavala.py@@ -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 {

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112