fixed #1470: Use local app data folder for personal path config file

This commit is contained in:
Jaex 2016-04-03 12:37:33 +03:00
parent afc7448109
commit bdc8331e5a

View file

@ -104,16 +104,25 @@ public static string TitleLong
#region Paths #region Paths
public static readonly string DefaultPersonalFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "ShareX"); private const string AppName = "ShareX";
private static readonly string PortablePersonalFolder = Helpers.GetAbsolutePath("ShareX"); private const string PersonalPathConfigFileName = "PersonalPath.cfg";
public static readonly string DefaultPersonalFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), AppName);
private static readonly string PortablePersonalFolder = Helpers.GetAbsolutePath(AppName);
private static readonly string PortableAppsPersonalFolder = Helpers.GetAbsolutePath("../../Data"); private static readonly string PortableAppsPersonalFolder = Helpers.GetAbsolutePath("../../Data");
private static string PersonalPathConfigFilePath private static string PersonalPathConfigFilePath
{ {
get get
{ {
string oldPath = Helpers.GetAbsolutePath("PersonalPath.cfg"); string oldPath = Helpers.GetAbsolutePath(PersonalPathConfigFileName);
return File.Exists(oldPath) ? oldPath : Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"ShareX\PersonalPath.cfg");
if (IsPortable || IsPortableApps || File.Exists(oldPath))
{
return oldPath;
}
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), AppName, PersonalPathConfigFileName);
} }
} }