Exemplo n.º 1
0
        internal static string InternalGetFolderPath(Environment.SpecialFolder folder)
        {
            string text  = Environment.internalGetHome();
            string text2 = Environment.internalGetEnvironmentVariable("XDG_DATA_HOME");

            if (text2 == null || text2 == string.Empty)
            {
                text2 = Path.Combine(text, ".local");
                text2 = Path.Combine(text2, "share");
            }
            string text3 = Environment.internalGetEnvironmentVariable("XDG_CONFIG_HOME");

            if (text3 == null || text3 == string.Empty)
            {
                text3 = Path.Combine(text, ".config");
            }
            switch (folder)
            {
            case Environment.SpecialFolder.Desktop:
            case Environment.SpecialFolder.DesktopDirectory:
                return(Environment.ReadXdgUserDir(text3, text, "XDG_DESKTOP_DIR", "Desktop"));

            case Environment.SpecialFolder.Programs:
            case Environment.SpecialFolder.Favorites:
            case Environment.SpecialFolder.Startup:
            case Environment.SpecialFolder.Recent:
            case Environment.SpecialFolder.SendTo:
            case Environment.SpecialFolder.StartMenu:
            case Environment.SpecialFolder.Templates:
            case Environment.SpecialFolder.InternetCache:
            case Environment.SpecialFolder.Cookies:
            case Environment.SpecialFolder.History:
            case Environment.SpecialFolder.System:
            case Environment.SpecialFolder.ProgramFiles:
            case Environment.SpecialFolder.CommonProgramFiles:
                return(string.Empty);

            case Environment.SpecialFolder.MyDocuments:
                return(text);

            case Environment.SpecialFolder.MyMusic:
                return(Environment.ReadXdgUserDir(text3, text, "XDG_MUSIC_DIR", "Music"));

            case Environment.SpecialFolder.MyComputer:
                return(string.Empty);

            case Environment.SpecialFolder.ApplicationData:
                return(text3);

            case Environment.SpecialFolder.LocalApplicationData:
                return(text2);

            case Environment.SpecialFolder.CommonApplicationData:
                return("/usr/share");

            case Environment.SpecialFolder.MyPictures:
                return(Environment.ReadXdgUserDir(text3, text, "XDG_PICTURES_DIR", "Pictures"));
            }
            throw new ArgumentException("Invalid SpecialFolder");
        }