39 lines
928 B
C#
39 lines
928 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Cowain.Base.Helpers;
|
|
|
|
public class PathHelper
|
|
{
|
|
private static string _localFolder = string.Empty;
|
|
|
|
private static string LocalFolder
|
|
{
|
|
get
|
|
{
|
|
if (!string.IsNullOrEmpty(_localFolder))
|
|
{
|
|
return _localFolder;
|
|
}
|
|
_localFolder = Path.Combine(
|
|
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
|
AppDomain.CurrentDomain.FriendlyName
|
|
);
|
|
if (!Directory.Exists(_localFolder))
|
|
{
|
|
Directory.CreateDirectory(_localFolder);
|
|
}
|
|
return _localFolder;
|
|
}
|
|
}
|
|
|
|
public static string GetLocalFilePath(string flieName)
|
|
{
|
|
return Path.Combine(LocalFolder, flieName);
|
|
}
|
|
|
|
}
|