[f-spot] Uri extensions methods
- From: Stephane Delcroix <sdelcroix src gnome org>
- To: svn-commits-list gnome org
- Subject: [f-spot] Uri extensions methods
- Date: Sat, 4 Jul 2009 13:17:13 +0000 (UTC)
commit db23918845eb70d84e550fcf06802bcaa1dbafcc
Author: Mike Gemünde <mike gemuende de>
Date: Thu Jun 25 20:56:46 2009 +0200
Uri extensions methods
extensions methods to get the "folder" like part and the "filename" like part.
src/Makefile.am | 1 +
src/Utils/UriExtensions.cs | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 23993ef..4672412 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -59,6 +59,7 @@ UTILS_CSDISTFILES = \
$(srcdir)/Utils/PixbufOrientation.cs \
$(srcdir)/Utils/PixbufUtils.cs \
$(srcdir)/Utils/Unix.cs \
+ $(srcdir)/Utils/UriExtensions.cs \
$(srcdir)/Utils/UriUtils.cs
JOBSCHEDULER_CSDISTFILES = \
diff --git a/src/Utils/UriExtensions.cs b/src/Utils/UriExtensions.cs
new file mode 100644
index 0000000..9991e63
--- /dev/null
+++ b/src/Utils/UriExtensions.cs
@@ -0,0 +1,34 @@
+/*
+ * FSpot.Utils.UriExtensions.cs
+ *
+ * Author(s)
+ * Mike Gemuende <mike gemuende de>
+ *
+ * This is free software. See COPYING for details.
+ */
+
+using System;
+
+namespace FSpot.Utils
+{
+
+ public static class UriExtensions
+ {
+ public static Uri GetDirectoryUri (this Uri uri)
+ {
+ UriBuilder builder = new UriBuilder (uri);
+ builder.Path =
+ String.Format ("{0}/", System.IO.Path.GetDirectoryName (uri.AbsolutePath));
+
+ return builder.Uri;
+ }
+
+ public static string GetFilename (this Uri uri)
+ {
+ if ( ! uri.IsFile)
+ return null;
+
+ return System.IO.Path.GetFileName (uri.AbsolutePath);
+ }
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]