[Mono-list] Environment.GetFolderPath() Questions...

Kevin White Kevin White <jedirunner@gmail.com>
Sat, 6 Nov 2004 10:45:53 -0700


Hi all, it's me again...

In writing a sample program that goes through the special folders, I
get lots of empty strings.  Are they empty because they aren't
implemented, or because in my particular environment they happen to be
empty (whereas in someone else's circumstances they would be
populated)?

My code snippet:

        int maxLen=0;
        foreach(String s in Enum.GetNames(typeof(Environment.SpecialFolder))){
            if(s.Length > maxLen){
                maxLen = s.Length;
            }
        }
        foreach(int i in Enum.GetValues(typeof(Environment.SpecialFolder))){
            String folderType;
            String folderName;
            folderType=((Environment.SpecialFolder)i).ToString();
            folderName=Environment.GetFolderPath((Environment.SpecialFolder)i);
            Console.WriteLine("{0," + maxLen + "} ==> {1}",
folderType, folderName);
        }


My results:

              Desktop ==> /home/kewhite/Desktop
             Programs ==>
             Personal ==> /home/kewhite
            Favorites ==>
              Startup ==>
               Recent ==>
               SendTo ==>
            StartMenu ==>
              MyMusic ==>
     DesktopDirectory ==> /home/kewhite/Desktop
           MyComputer ==>
            Templates ==>
      ApplicationData ==> /home/kewhite/.config
 LocalApplicationData ==> /home/kewhite/.local/share
        InternetCache ==>
              Cookies ==>
              History ==>
CommonApplicationData ==> /usr/share
               System ==>
         ProgramFiles ==>
           MyPictures ==>
   CommonProgramFiles ==>

Thanks once again,

Kevin
-- 
Kevin White
jedirunner@gmail.com