mirror of
https://github.com/SabreTools/SabreTools.IO.git
synced 2026-09-23 07:05:38 +00:00
Add GetHomeDirectory
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using SabreTools.IO.Extensions;
|
||||
@@ -166,6 +167,18 @@ namespace SabreTools.IO
|
||||
return infiles;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the home directory for the current user
|
||||
/// </summary>
|
||||
public static string GetHomeDirectory()
|
||||
{
|
||||
#if NET20 || NET35
|
||||
return Environment.ExpandEnvironmentVariables("%HOMEDRIVE%%HOMEPATH%");
|
||||
#else
|
||||
return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the runtime directory
|
||||
/// </summary>
|
||||
@@ -174,7 +187,7 @@ namespace SabreTools.IO
|
||||
#if NET20 || NET35 || NET40 || NET452
|
||||
return Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
#else
|
||||
return System.AppContext.BaseDirectory;
|
||||
return AppContext.BaseDirectory;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user