Beispiel #1
0
            public static string GetTarget(string path)
            {
                //var link = new Mono.Unix.UnixSymbolicLinkInfo(path);
                var link = new SymlinkMono(path);

                //return link.ContentsPath;
                return((string)MonoType.GetProperty("ContentsPath").GetValue(link.MonoObj));
            }
Beispiel #2
0
            public static void Delete(string path)
            {
                //var link = new Mono.Unix.UnixSymbolicLinkInfo(path);
                var link = new SymlinkMono(path);

                // link.Delete();
                MethodInfo method = MonoType.GetMethod("Delete");

                method.Invoke(link.MonoObj, null);
            }
Beispiel #3
0
            public static bool CreateSymlink(string path, string target)
            {
                target = target.Replace('\\', '/');

                //var link = new Mono.Unix.UnixSymbolicLinkInfo(path);
                var link = new SymlinkMono(path);

                //link.CreateSymbolicLinkTo(target);
                MethodInfo method = MonoType.GetMethod("CreateSymbolicLinkTo", new Type[] { typeof(string) });

                method.Invoke(link.MonoObj, new object[] { target });

                // return link.HasContents;
                return((bool)MonoType.GetProperty("HasContents").GetValue(link.MonoObj));
            }
Beispiel #4
0
        public static string GetTarget(string path)
        {
            if (!Exists(path))
            {
                return(null);
            }

            if (SvnIntegration.AppliesTo(path))
            {
                return(SvnIntegration.GetSymlinkTarget(path));
            }

            if (MultiArchPInvoke.IsRunningOnMono)
            {
                return(SymlinkMono.GetTarget(path));
            }
            else
            {
                return(SymlinkWin32.GetTarget(path));
            }
        }
Beispiel #5
0
        public static bool Create(string path, string target, bool clearExisting = false)
        {
            if (clearExisting)
            {
                try
                {
                    if (Exists(path))
                    {
                        Delete(path);
                    }
                    else if (File.Exists(path))
                    {
                        File.Delete(path);
                    }
                    else if (Directory.Exists(path))
                    {
                        Directory.Delete(path);
                    }
                }
                catch
                {
                    Printer.PrintError("Could not create symlink {0}, it is obstructed!", path);
                    return(false);
                }
            }

            if (SvnIntegration.AppliesTo(path))
            {
                return(SvnIntegration.CreateSymlink(path, target));
            }

            if (MultiArchPInvoke.IsRunningOnMono)
            {
                return(SymlinkMono.CreateSymlink(path, target));
            }
            else
            {
                return(SymlinkWin32.CreateSymlink(path, target));
            }
        }
Beispiel #6
0
        public static void Delete(string path)
        {
            if (!Exists(path))
            {
                return;
            }

            if (SvnIntegration.AppliesTo(path))
            {
                SvnIntegration.DeleteSymlink(path);
                return;
            }

            if (MultiArchPInvoke.IsRunningOnMono)
            {
                SymlinkMono.Delete(path);
            }
            else
            {
                SymlinkWin32.Delete(path);
            }
        }
Beispiel #7
0
			public static void Delete(string path)
			{
				//var link = new Mono.Unix.UnixSymbolicLinkInfo(path);
				var link = new SymlinkMono(path);

				// link.Delete();
				MethodInfo method = MonoType.GetMethod("Delete");
				method.Invoke(link.MonoObj, null);
			}
Beispiel #8
0
			public static string GetTarget(string path)
			{
				//var link = new Mono.Unix.UnixSymbolicLinkInfo(path);
				var link = new SymlinkMono(path);

				//return link.ContentsPath;
				return (string)MonoType.GetProperty("ContentsPath").GetValue(link.MonoObj);
			}
Beispiel #9
0
			public static bool CreateSymlink(string path, string target)
			{
				target = target.Replace('\\', '/');

				//var link = new Mono.Unix.UnixSymbolicLinkInfo(path);
				var link = new SymlinkMono(path);

				//link.CreateSymbolicLinkTo(target);
				MethodInfo method = MonoType.GetMethod("CreateSymbolicLinkTo", new Type[] { typeof(string) });
				method.Invoke(link.MonoObj, new object[] { target });

				// return link.HasContents;
				return (bool)MonoType.GetProperty("HasContents").GetValue(link.MonoObj);
			}