mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-02 21:20:28 +12:00
Update personal path before debug helper init otherwise in portable build logger will save to incorrect folder
This commit is contained in:
parent
b6959520a9
commit
c101742d2c
|
@ -93,7 +93,7 @@ private void WriteLineInternal(string message)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(LogFilePath))
|
if (!string.IsNullOrEmpty(LogFilePath))
|
||||||
{
|
{
|
||||||
File.AppendAllText(LogFilePath, message, Encoding.UTF8);
|
File.AppendAllText(LogFilePath, message + Environment.NewLine, Encoding.UTF8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
@ -243,8 +243,6 @@ public static string ScreenshotsFolder
|
||||||
[STAThread]
|
[STAThread]
|
||||||
private static void Main(string[] args)
|
private static void Main(string[] args)
|
||||||
{
|
{
|
||||||
DebugHelper.Init(LogsFilePath);
|
|
||||||
|
|
||||||
Application.ThreadException += Application_ThreadException;
|
Application.ThreadException += Application_ThreadException;
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
|
|
||||||
|
@ -259,6 +257,10 @@ private static void Main(string[] args)
|
||||||
|
|
||||||
if (CheckAdminTasks()) return; // If ShareX opened just for be able to execute task as Admin
|
if (CheckAdminTasks()) return; // If ShareX opened just for be able to execute task as Admin
|
||||||
|
|
||||||
|
UpdatePersonalPath();
|
||||||
|
|
||||||
|
DebugHelper.Init(LogsFilePath);
|
||||||
|
|
||||||
IsMultiInstance = CLI.IsCommandExist("multi", "m");
|
IsMultiInstance = CLI.IsCommandExist("multi", "m");
|
||||||
|
|
||||||
if (IsMultiInstance || ApplicationInstanceManager.CreateSingleInstance(SingleInstanceCallback, args))
|
if (IsMultiInstance || ApplicationInstanceManager.CreateSingleInstance(SingleInstanceCallback, args))
|
||||||
|
@ -281,36 +283,6 @@ private static void Run()
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
||||||
IsSilentRun = CLI.IsCommandExist("silent", "s");
|
IsSilentRun = CLI.IsCommandExist("silent", "s");
|
||||||
IsSandbox = CLI.IsCommandExist("sandbox");
|
|
||||||
|
|
||||||
if (!IsSandbox)
|
|
||||||
{
|
|
||||||
IsPortable = CLI.IsCommandExist("portable", "p");
|
|
||||||
|
|
||||||
if (IsPortable)
|
|
||||||
{
|
|
||||||
CustomPersonalPath = PortablePersonalFolder;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IsPortable = File.Exists(PortableCheckFilePath);
|
|
||||||
CheckPersonalPathConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Directory.Exists(PersonalFolder))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(PersonalFolder);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
MessageBox.Show(Resources.Program_Run_Unable_to_create_folder_ + string.Format(" \"{0}\"\r\n\r\n{1}", PersonalFolder, e),
|
|
||||||
"ShareX - " + Resources.Program_Run_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
CustomPersonalPath = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if STEAM
|
#if STEAM
|
||||||
IsFirstTimeConfig = CLI.IsCommandExist("SteamConfig");
|
IsFirstTimeConfig = CLI.IsCommandExist("SteamConfig");
|
||||||
|
@ -444,6 +416,40 @@ public static void BackupSettings()
|
||||||
Helpers.BackupFileWeekly(HistoryFilePath, BackupFolder);
|
Helpers.BackupFileWeekly(HistoryFilePath, BackupFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void UpdatePersonalPath()
|
||||||
|
{
|
||||||
|
IsSandbox = CLI.IsCommandExist("sandbox");
|
||||||
|
|
||||||
|
if (!IsSandbox)
|
||||||
|
{
|
||||||
|
IsPortable = CLI.IsCommandExist("portable", "p");
|
||||||
|
|
||||||
|
if (IsPortable)
|
||||||
|
{
|
||||||
|
CustomPersonalPath = PortablePersonalFolder;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IsPortable = File.Exists(PortableCheckFilePath);
|
||||||
|
CheckPersonalPathConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Directory.Exists(PersonalFolder))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(PersonalFolder);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MessageBox.Show(Resources.Program_Run_Unable_to_create_folder_ + string.Format(" \"{0}\"\r\n\r\n{1}", PersonalFolder, e),
|
||||||
|
"ShareX - " + Resources.Program_Run_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
CustomPersonalPath = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void CheckPersonalPathConfig()
|
private static void CheckPersonalPathConfig()
|
||||||
{
|
{
|
||||||
string customPersonalPath = ReadPersonalPathConfig();
|
string customPersonalPath = ReadPersonalPathConfig();
|
||||||
|
|
Loading…
Reference in a new issue