Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • AppData folder i.e. %appdata%

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 334
    Comment on it

    In Windows Application programming, many developers create the log file in the app directory which is not always available to a regular user and its not a good idea.

    The log file should probably go in the AppData folder i.e. %appdata% as long as it can be opened from the application.

    Here is the source code to get path of appdata folder then you can create another directory under the appfolder:

    C# code:

    // The folder for the roaming current user 
    string appDataFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData);
    
    // Combine the base folder with your specific i.e. application folder....
    string specificFolder = System.IO.Path.Combine(appDataFolder ,[ApplicationFolderName]);

     

    VB.Net code:

    ' The folder for the roaming current user 
    Dim appDataFolder As String =  System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) 
     
    ' Combine the base folder with your specific i.e. application folder....
    Dim specificFolder As String =  System.IO.Path.Combine(appDataFolder,(ApplicationFolderName))

    Happy Coding!!

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: