Ejemplo n.º 1
0
        public static string ResolveShortCut(string path)
        {
            if (FolderPlaneUtils.IsLink(path))
            {
                // First working solution chosen to resolve link
                // For using IWshRuntimeLibrary add reference, Com tab, choose Microsoft Shell Controls and Automation
                // Question: must we dispose shell, I assume this is a Managed wrapper around com

                IWshRuntimeLibrary.WshShell     shell = new IWshRuntimeLibrary.WshShell();
                IWshRuntimeLibrary.IWshShortcut link  = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(path);

                string target = link.TargetPath;
                return(target);
            }

            // If not found, keep original path
            return(path);
        }