Added PortableApps support which will use custom personal path and disable updating

This commit is contained in:
Jaex 2016-01-07 19:48:59 +02:00
parent 066a81fa7f
commit 13e1f68c28
4 changed files with 20 additions and 4 deletions

View file

@ -52,7 +52,7 @@ private void Write(string text, string timeText)
timeText = text + ": " + timeText;
}
DebugHelper.WriteLine(timeText);
Debug.WriteLine(timeText);
}
public void WriteElapsedSeconds(string text = null)

View file

@ -48,7 +48,15 @@ public AboutForm()
#else
pbSteam.Visible = false;
lblSteamBuild.Visible = false;
uclUpdate.CheckUpdate(TaskHelpers.CheckUpdate);
if (!Program.IsPortableApps)
{
uclUpdate.CheckUpdate(TaskHelpers.CheckUpdate);
}
else
{
uclUpdate.Visible = false;
}
#endif
lblTeam.Text = "ShareX Team:";

View file

@ -691,7 +691,7 @@ private void ConfigureAutoUpdate()
#if RELEASE
lock (updateTimerLock)
{
if (Program.Settings.AutoCheckUpdate)
if (!Program.IsPortableApps && Program.Settings.AutoCheckUpdate)
{
if (updateTimer == null)
{

View file

@ -80,6 +80,7 @@ public static string TitleLong
public static CLIManager CLI { get; private set; }
public static bool IsMultiInstance { get; private set; }
public static bool IsPortable { get; private set; }
public static bool IsPortableApps { get; private set; }
public static bool IsSilentRun { get; private set; }
public static bool IsSandbox { get; private set; }
public static bool IsFirstTimeConfig { get; private set; }
@ -106,8 +107,10 @@ public static string TitleLong
public static readonly string DefaultPersonalFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "ShareX");
private static readonly string PortablePersonalFolder = Helpers.GetAbsolutePath("ShareX");
private static readonly string PortableAppsPersonalFolder = Helpers.GetAbsolutePath("../../Data");
private static readonly string PersonalPathConfigFilePath = Helpers.GetAbsolutePath("PersonalPath.cfg");
private static readonly string PortableCheckFilePath = Helpers.GetAbsolutePath("Portable");
private static readonly string PortableAppsCheckFilePath = Helpers.GetAbsolutePath("PortableApps");
public static readonly string ChromeHostFilePath = Helpers.GetAbsolutePath("ShareX_Chrome.exe");
public static readonly string SteamInAppFilePath = Helpers.GetAbsolutePath("Steam");
@ -430,7 +433,8 @@ private static void UpdatePersonalPath()
}
else
{
IsPortable = File.Exists(PortableCheckFilePath);
IsPortableApps = File.Exists(PortableAppsCheckFilePath);
IsPortable = IsPortableApps || File.Exists(PortableCheckFilePath);
CheckPersonalPathConfig();
}
@ -459,6 +463,10 @@ private static void CheckPersonalPathConfig()
customPersonalPath = Environment.ExpandEnvironmentVariables(customPersonalPath);
CustomPersonalPath = Helpers.GetAbsolutePath(customPersonalPath);
}
else if (IsPortableApps)
{
CustomPersonalPath = PortableAppsPersonalFolder;
}
else if (IsPortable)
{
CustomPersonalPath = PortablePersonalFolder;