[ease/inspector] Use build_filename instead of build_path.



commit 4678d97536be5d57f0c3cef563178e279816469b
Author: Nate Stedman <natesm gmail com>
Date:   Sat Jun 5 19:31:50 2010 -0400

    Use build_filename instead of build_path.

 src/Element.vala       |    2 +-
 src/JSONParser.vala    |    6 +++---
 src/Slide.vala         |    2 +-
 src/Temp.vala          |   25 ++++++++-----------------
 src/VideoActor.vala    |    4 ++--
 src/WelcomeWindow.vala |    2 +-
 6 files changed, 16 insertions(+), 25 deletions(-)
---
diff --git a/src/Element.vala b/src/Element.vala
index be9a9af..f5d5bfb 100644
--- a/src/Element.vala
+++ b/src/Element.vala
@@ -559,7 +559,7 @@ public class Ease.Element : GLib.Object
 	{
 		owned get
 		{
-			var str = Path.build_path("/", parent.parent.path, filename);
+			var str = Path.build_filename(parent.parent.path, filename);
 			return str;
 		}
 	}
diff --git a/src/JSONParser.vala b/src/JSONParser.vala
index bb5372d..eac10fb 100644
--- a/src/JSONParser.vala
+++ b/src/JSONParser.vala
@@ -33,7 +33,7 @@ public static class Ease.JSONParser
 		var parser = new Json.Parser();
 		
 		// attempt to load the file
-		parser.load_from_file(Path.build_path("/", filename, "Document.json"));
+		parser.load_from_file(Path.build_filename(filename, "Document.json"));
 		
 		// grab the root object
 		var root = parser.get_root().get_object();
@@ -67,7 +67,7 @@ public static class Ease.JSONParser
 		var parser = new Json.Parser();
 		
 		// attempt to load the file
-		parser.load_from_file(Path.build_path("/", theme.path, "Theme.json"));
+		parser.load_from_file(Path.build_filename(theme.path, "Theme.json"));
 		
 		// grab the root object
 		var root = parser.get_root().get_object();
@@ -184,7 +184,7 @@ public static class Ease.JSONParser
 		var generator = new Json.Generator();
 		generator.set_root(root);
 		generator.pretty = true;
-		generator.to_file(Path.build_path("/", document.path, "Document.json"));
+		generator.to_file(Path.build_filename(document.path, "Document.json"));
 	}
 	
 	private static Json.Node document_write_slide(Slide slide)
diff --git a/src/Slide.vala b/src/Slide.vala
index 200af22..de1ee45 100644
--- a/src/Slide.vala
+++ b/src/Slide.vala
@@ -81,7 +81,7 @@ public class Ease.Slide
 		owned get
 		{
 			string p = parent == null ? theme.path : parent.path;
-			return Path.build_path("/", p, background_image);
+			return Path.build_filename(p, background_image);
 		}
 	}
 	
diff --git a/src/Temp.vala b/src/Temp.vala
index ca5ed88..0f5c813 100644
--- a/src/Temp.vala
+++ b/src/Temp.vala
@@ -33,35 +33,26 @@ public static class Ease.Temp : Object
 	 */
 	public static string request() throws GLib.Error
 	{
+		// get the temporary directory
+		string tmp = Environment.get_tmp_dir();
+		
 		// remove any temporary directories from previous runs of Ease
 		if (index == 0)
 		{
-			string tmp = Environment.get_tmp_dir();
-			var file =
-				GLib.File.new_for_path(Path.build_path("/", tmp, "ease"));
+			var ease_tmp = Path.build_filename(tmp, "ease");
+			var file = GLib.File.new_for_path(ease_tmp);
 			
 			if (file.query_exists(null))
 			{
 				// TODO: not this
-				Posix.system("rm -rf /tmp/ease");
-//				var enumerator = file.enumerate_children("standard::", 0, null);
-//				
-//				var info = enumerator.next_file(null);
-//				while (info != null)
-//				{
-//					stdout.printf("%s\n", info.get_display_name());
-//					info = enumerator.next_file(null);
-//				}
-//				
-//				file.delete(null);
+				Posix.system("rm -rf %s".printf(ease_tmp));
 			}
 		}
 		
 		index++;
 		
 		// build the path
-		string tmp = Environment.get_tmp_dir();
-		tmp = Path.build_path("/", tmp, "ease", index.to_string());
+		tmp = Path.build_filename(tmp, "ease", index.to_string());
 		
 		// make the directory
 		var file = GLib.File.new_for_path(tmp);
@@ -98,7 +89,7 @@ public static class Ease.Temp : Object
 		weak Archive.Entry entry;
 		while (archive.next_header(out entry) == Archive.Result.OK)
 		{
-			var fpath = Path.build_path("/", path, entry.pathname());
+			var fpath = Path.build_filename(path, entry.pathname());
 			var file = GLib.File.new_for_path(fpath);
 			if (Posix.S_ISDIR(entry.mode()))
 			{
diff --git a/src/VideoActor.vala b/src/VideoActor.vala
index b5a51ed..1fb2d16 100644
--- a/src/VideoActor.vala
+++ b/src/VideoActor.vala
@@ -40,8 +40,8 @@ public class Ease.VideoActor : Actor, Clutter.Media
 		base(e, c);
 
 		video = new ClutterGst.VideoTexture();
-		video.set_filename(Path.build_path("/", e.parent.parent.path,
-		                                   e.get("filename")));
+		video.set_filename(Path.build_filename(e.parent.parent.path,
+		                                       e.get("filename")));
 
 		// play the video if it's in the presentation
 		if (c == ActorContext.PRESENTATION)
diff --git a/src/WelcomeWindow.vala b/src/WelcomeWindow.vala
index ebde761..17269ac 100644
--- a/src/WelcomeWindow.vala
+++ b/src/WelcomeWindow.vala
@@ -158,7 +158,7 @@ public class Ease.WelcomeWindow : Gtk.Window
 			string name = dir.read_name();
 			while (name != null)
 			{
-				var path = Path.build_path("/", THEME_DIR, name);
+				var path = Path.build_filename(THEME_DIR, name);
 				themes.add(JSONParser.theme(path));
 				name = dir.read_name();
 			}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]