Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Issue with Environment.SpecialFolder.MyDocuments

Issue with Environment.SpecialFolder.MyDocuments

Scheduled Pinned Locked Moved C#
questionhelpworkspace
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    False Chicken
    wrote on last edited by
    #1

    I am having an issue with this. I need to create a folder in the current users application data folder to store settings but I cannot. Every time I try to use Directory.CreateDirectory(Environment.SpecialFolder.MyDocuments + "/JFE/Settings") Or anything else under SpecialFolder it will just create a folder in the application's directory with a name like Personal then inside this directory it will make the folders I requested. Why does it do this? I printed out the string for the special folder and looked at it and it is correct but for some reason it creates my folders in the current program's directory.

    Y*Live Long And Prosper*Y

    J 1 Reply Last reply
    0
    • F False Chicken

      I am having an issue with this. I need to create a folder in the current users application data folder to store settings but I cannot. Every time I try to use Directory.CreateDirectory(Environment.SpecialFolder.MyDocuments + "/JFE/Settings") Or anything else under SpecialFolder it will just create a folder in the application's directory with a name like Personal then inside this directory it will make the folders I requested. Why does it do this? I printed out the string for the special folder and looked at it and it is correct but for some reason it creates my folders in the current program's directory.

      Y*Live Long And Prosper*Y

      J Offline
      J Offline
      Johnny J
      wrote on last edited by
      #2

      Try this:

      Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "JFE/Settings"))

      Good luck PS: The big change is Environment.GetFolderPath. Path.Combine I just inserted because it's better to use that than concatenate the path using "+"

      F 1 Reply Last reply
      0
      • J Johnny J

        Try this:

        Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "JFE/Settings"))

        Good luck PS: The big change is Environment.GetFolderPath. Path.Combine I just inserted because it's better to use that than concatenate the path using "+"

        F Offline
        F Offline
        False Chicken
        wrote on last edited by
        #3

        Worked! Thanks!

        Y*Live Long And Prosper*Y

        J 1 Reply Last reply
        0
        • F False Chicken

          Worked! Thanks!

          Y*Live Long And Prosper*Y

          J Offline
          J Offline
          Johnny J
          wrote on last edited by
          #4

          Of course! Learn from the master, my young jedi... :)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups