mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-16 15:24:10 +02:00
Added safe mode
This commit is contained in:
parent
72242aa31c
commit
72411118c2
4 changed files with 80 additions and 6 deletions
|
@ -39,6 +39,30 @@ namespace System.Diagnostics
|
||||||
outFileName.Append(mFileName);
|
outFileName.Append(mFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetFileNameAndArguments(StringView string)
|
||||||
|
{
|
||||||
|
if (string.StartsWith('"'))
|
||||||
|
{
|
||||||
|
int endPos = string.IndexOf('"', 1);
|
||||||
|
if (endPos != -1)
|
||||||
|
{
|
||||||
|
SetFileName(.(string, 1, endPos - 1));
|
||||||
|
SetArguments(.(string, endPos + 2));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int spacePos = string.IndexOf(' ');
|
||||||
|
if (spacePos != -1)
|
||||||
|
{
|
||||||
|
SetFileName(.(string, 0, spacePos));
|
||||||
|
SetArguments(.(string, spacePos + 1));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetFileName(string);
|
||||||
|
}
|
||||||
|
|
||||||
public void SetFileName(StringView fileName)
|
public void SetFileName(StringView fileName)
|
||||||
{
|
{
|
||||||
mFileName.Set(fileName);
|
mFileName.Set(fileName);
|
||||||
|
|
|
@ -149,6 +149,8 @@ namespace IDE
|
||||||
public DateTime mDbgHighestTime;
|
public DateTime mDbgHighestTime;
|
||||||
public bool mForceFirstRun;
|
public bool mForceFirstRun;
|
||||||
public bool mIsFirstRun;
|
public bool mIsFirstRun;
|
||||||
|
public bool mSafeMode;
|
||||||
|
public String mDeferredRelaunchCmd ~ delete _;
|
||||||
public int? mTargetExitCode;
|
public int? mTargetExitCode;
|
||||||
public FileVersionInfo mVersionInfo ~ delete _;
|
public FileVersionInfo mVersionInfo ~ delete _;
|
||||||
|
|
||||||
|
@ -730,6 +732,16 @@ namespace IDE
|
||||||
|
|
||||||
// Clear these out, for delete ordering purposes
|
// Clear these out, for delete ordering purposes
|
||||||
ProcessDeferredDeletes();
|
ProcessDeferredDeletes();
|
||||||
|
|
||||||
|
if (mDeferredRelaunchCmd != null)
|
||||||
|
{
|
||||||
|
ProcessStartInfo psi = scope ProcessStartInfo();
|
||||||
|
psi.SetFileNameAndArguments(mDeferredRelaunchCmd);
|
||||||
|
psi.UseShellExecute = false;
|
||||||
|
|
||||||
|
SpawnedProcess process = scope SpawnedProcess();
|
||||||
|
process.Start(psi).IgnoreError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsCrashDump
|
public bool IsCrashDump
|
||||||
|
@ -2610,16 +2622,23 @@ namespace IDE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
String relaunchCmd = scope .();
|
String relaunchCmd = scope .();
|
||||||
relaunchCmd.Append("\"");
|
GetRelaunchCmd(true, relaunchCmd);
|
||||||
Environment.GetExecutableFilePath(relaunchCmd);
|
|
||||||
relaunchCmd.Append("\" -workspace=\"");
|
|
||||||
relaunchCmd.Append(mWorkspace.mDir);
|
|
||||||
relaunchCmd.Append("\"");
|
|
||||||
Platform.BfpSystem_SetCrashRelaunchCmd(relaunchCmd);
|
Platform.BfpSystem_SetCrashRelaunchCmd(relaunchCmd);
|
||||||
|
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GetRelaunchCmd(bool safeMode, String outRelaunchCmd)
|
||||||
|
{
|
||||||
|
outRelaunchCmd.Append("\"");
|
||||||
|
Environment.GetExecutableFilePath(outRelaunchCmd);
|
||||||
|
outRelaunchCmd.Append("\" -workspace=\"");
|
||||||
|
outRelaunchCmd.Append(mWorkspace.mDir);
|
||||||
|
outRelaunchCmd.Append("\"");
|
||||||
|
if (safeMode)
|
||||||
|
outRelaunchCmd.Append(" -safe");
|
||||||
|
}
|
||||||
|
|
||||||
public void RetryProjectLoad(Project project)
|
public void RetryProjectLoad(Project project)
|
||||||
{
|
{
|
||||||
LoadConfig();
|
LoadConfig();
|
||||||
|
@ -6897,6 +6916,16 @@ namespace IDE
|
||||||
mLaunchData.mPaused = true;
|
mLaunchData.mPaused = true;
|
||||||
else
|
else
|
||||||
Fail("'-launchPaused' can only be used after '-launch'");
|
Fail("'-launchPaused' can only be used after '-launch'");
|
||||||
|
case "-safe":
|
||||||
|
#if !CLI && BF_PLATFORM_WINDOWS
|
||||||
|
if (Windows.MessageBoxA(default, "Start the IDE in safe mode? This will disable code intelligence features.", "SAFE MODE?",
|
||||||
|
Windows.MB_ICONQUESTION | Windows.MB_YESNO) != Windows.IDYES)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
mSafeMode = true;
|
||||||
|
mNoResolve = true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,7 +355,8 @@ namespace IDE.ui
|
||||||
}
|
}
|
||||||
|
|
||||||
let compiler = gApp.mBfResolveCompiler;
|
let compiler = gApp.mBfResolveCompiler;
|
||||||
if ((!compiler.IsPerformingBackgroundOperation()) && (compiler.mResolveAllWait == 0))
|
if ((compiler == null) ||
|
||||||
|
((!compiler.IsPerformingBackgroundOperation()) && (compiler.mResolveAllWait == 0)))
|
||||||
mDirtyTicks = 0;
|
mDirtyTicks = 0;
|
||||||
else
|
else
|
||||||
mDirtyTicks++;
|
mDirtyTicks++;
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace IDE.ui
|
||||||
public int32 mClangCommandQueueSize;
|
public int32 mClangCommandQueueSize;
|
||||||
public DarkComboBox mConfigComboBox;
|
public DarkComboBox mConfigComboBox;
|
||||||
public DarkComboBox mPlatformComboBox;
|
public DarkComboBox mPlatformComboBox;
|
||||||
|
public DarkButton mSafeModeButton;
|
||||||
public bool mWasCompiling;
|
public bool mWasCompiling;
|
||||||
public int mEvalCount;
|
public int mEvalCount;
|
||||||
public ImageWidget mCancelSymSrvButton;
|
public ImageWidget mCancelSymSrvButton;
|
||||||
|
@ -36,6 +37,20 @@ namespace IDE.ui
|
||||||
mPlatformComboBox.mFrameKind = .Frameless;
|
mPlatformComboBox.mFrameKind = .Frameless;
|
||||||
mPlatformComboBox.mPopulateMenuAction.Add(new => PopulatePlatformMenu);
|
mPlatformComboBox.mPopulateMenuAction.Add(new => PopulatePlatformMenu);
|
||||||
AddWidget(mPlatformComboBox);
|
AddWidget(mPlatformComboBox);
|
||||||
|
|
||||||
|
if (gApp.mSafeMode)
|
||||||
|
{
|
||||||
|
mSafeModeButton = new DarkButton();
|
||||||
|
mSafeModeButton.Label = "Disable Safe Mode";
|
||||||
|
mSafeModeButton.mOnMouseClick.Add(new (mouseArgs) =>
|
||||||
|
{
|
||||||
|
delete gApp.mDeferredRelaunchCmd;
|
||||||
|
gApp.mDeferredRelaunchCmd = new String();
|
||||||
|
gApp.GetRelaunchCmd(false, gApp.mDeferredRelaunchCmd);
|
||||||
|
gApp.Stop();
|
||||||
|
});
|
||||||
|
AddWidget(mSafeModeButton);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopulateConfigMenu(Menu menu)
|
void PopulateConfigMenu(Menu menu)
|
||||||
|
@ -101,6 +116,11 @@ namespace IDE.ui
|
||||||
|
|
||||||
if (mCancelSymSrvButton != null)
|
if (mCancelSymSrvButton != null)
|
||||||
mCancelSymSrvButton.Resize(GS!(546), 0, GS!(20), GS!(20));
|
mCancelSymSrvButton.Resize(GS!(546), 0, GS!(20), GS!(20));
|
||||||
|
|
||||||
|
if (mSafeModeButton != null)
|
||||||
|
{
|
||||||
|
mSafeModeButton.Resize(mPlatformComboBox.mX - GS!(200), GS!(-2), GS!(180), GS!(24));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Resize(float x, float y, float width, float height)
|
public override void Resize(float x, float y, float width, float height)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue