[SOLVED] [VB] Pointing to user folder

Discussion in 'Mixed Languages' started by QuantumBug, Sep 12, 2012.

  1. QuantumBug

    QuantumBug MDL Developer

    Mar 7, 2012
    1,530
    1,388
    60
    #1 QuantumBug, Sep 12, 2012
    Last edited: Sep 12, 2012
    Well I'm creating a Fable 3 GFWL content backup tool and when using Environment.GetFolderPath(Environment.SpecialFolder.xxxxx) I noticed it doesn't have any pointer for the user folder e.g C:\Users\David\etc

    Does anyone know how to get the direct location of the user folder. I essentially want to get to the path in the image below. Obviously I know how to get there but would prefer a direct point to the location to make the application more compatible on different machines.

    [​IMG]

    Thanks, Dave.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. QuantumBug

    QuantumBug MDL Developer

    Mar 7, 2012
    1,530
    1,388
    60
    #2 QuantumBug, Sep 12, 2012
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Ok I sorted it myself, this worked for me...

    Code:
    Environment.GetEnvironmentVariable("USERPROFILE") + "\Saved Games\Lionhead Studios\Fable 3\"
    Environment.GetEnvironmentVariable("USERPROFILE") returns 'C:\Users\Username'
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. master131

    master131 MDL Novice

    Apr 12, 2011
    45
    22
    0
    Environment.SpecialFolder.UserProfile

    Doesn't that work? (I know you've fixed it already).
     
  4. QuantumBug

    QuantumBug MDL Developer

    Mar 7, 2012
    1,530
    1,388
    60
    #4 QuantumBug, Sep 13, 2012
    Last edited: Sep 13, 2012
    (OP)
    [​IMG]

    It would have been nice for M$ to add that though. It's a well used location for storing data.

    Although the code I used works just as well.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Josh Cell

    Josh Cell MDL Developer

    Jan 8, 2011
    3,519
    7,112
    120
    Supported on .NET Framework 4 or greater.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. QuantumBug

    QuantumBug MDL Developer

    Mar 7, 2012
    1,530
    1,388
    60
    Oh, I didn't know that as I don't use .NETFW4. Thanks Josh! :D

    Only because I use Qios for .NETFW2, maybe time for a change.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...