[banshee] [solitary] resolve symlinks to their targets



commit b19301ee24a4358afd6e11edd1d65f1a6ae384fa
Author: Aaron Bockover <abockover novell com>
Date:   Tue Dec 29 18:47:16 2009 -0500

    [solitary] resolve symlinks to their targets

 build/bundle/solitary/Item.cs  |   20 +++++++++++++++++++-
 build/bundle/solitary/Makefile |    2 +-
 2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/build/bundle/solitary/Item.cs b/build/bundle/solitary/Item.cs
index ca7202f..98efcde 100644
--- a/build/bundle/solitary/Item.cs
+++ b/build/bundle/solitary/Item.cs
@@ -28,12 +28,30 @@ using System;
 using System.IO;
 using System.Collections.Generic;
 
+using Mono.Unix;
+
 public abstract class Item
 {
-    public FileInfo File { get; set; }
     public Solitary Confinement { get; set; }
     public abstract IEnumerable<Item> Load ();
 
+    private FileInfo file;
+    public FileInfo File {
+        get { return file; }
+        set {
+            if (value == null) {
+                file = null;
+                return;
+            }
+
+            file = value;
+            var link = new UnixSymbolicLinkInfo (file.FullName);
+            if (link.HasContents) {
+                file = new FileInfo (link.GetContents ().FullName);
+            }
+        }
+    }
+
     public static Item Resolve (Solitary confinement, FileInfo file)
     {
         if (file.Name.StartsWith (".")) {
diff --git a/build/bundle/solitary/Makefile b/build/bundle/solitary/Makefile
index 2199866..c23b2c1 100644
--- a/build/bundle/solitary/Makefile
+++ b/build/bundle/solitary/Makefile
@@ -10,7 +10,7 @@ SOURCE = \
 all: $(ASSEMBLY)
 
 $(ASSEMBLY): $(SOURCE)
-	gmcs -out:$@ -debug $(SOURCE)
+	gmcs -out:$@ -debug -r:Mono.Posix $(SOURCE)
 
 Options.cs:
 	cp `pkg-config --variable=Sources mono-options` .



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