mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
mFileName.Set(fileName);
|
||||
|
|
|
@ -149,6 +149,8 @@ namespace IDE
|
|||
public DateTime mDbgHighestTime;
|
||||
public bool mForceFirstRun;
|
||||
public bool mIsFirstRun;
|
||||
public bool mSafeMode;
|
||||
public String mDeferredRelaunchCmd ~ delete _;
|
||||
public int? mTargetExitCode;
|
||||
public FileVersionInfo mVersionInfo ~ delete _;
|
||||
|
||||
|
@ -730,6 +732,16 @@ namespace IDE
|
|||
|
||||
// Clear these out, for delete ordering purposes
|
||||
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
|
||||
|
@ -2610,16 +2622,23 @@ namespace IDE
|
|||
#endif
|
||||
|
||||
String relaunchCmd = scope .();
|
||||
relaunchCmd.Append("\"");
|
||||
Environment.GetExecutableFilePath(relaunchCmd);
|
||||
relaunchCmd.Append("\" -workspace=\"");
|
||||
relaunchCmd.Append(mWorkspace.mDir);
|
||||
relaunchCmd.Append("\"");
|
||||
GetRelaunchCmd(true, relaunchCmd);
|
||||
Platform.BfpSystem_SetCrashRelaunchCmd(relaunchCmd);
|
||||
|
||||
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)
|
||||
{
|
||||
LoadConfig();
|
||||
|
@ -6897,6 +6916,16 @@ namespace IDE
|
|||
mLaunchData.mPaused = true;
|
||||
else
|
||||
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:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -355,7 +355,8 @@ namespace IDE.ui
|
|||
}
|
||||
|
||||
let compiler = gApp.mBfResolveCompiler;
|
||||
if ((!compiler.IsPerformingBackgroundOperation()) && (compiler.mResolveAllWait == 0))
|
||||
if ((compiler == null) ||
|
||||
((!compiler.IsPerformingBackgroundOperation()) && (compiler.mResolveAllWait == 0)))
|
||||
mDirtyTicks = 0;
|
||||
else
|
||||
mDirtyTicks++;
|
||||
|
|
|
@ -19,6 +19,7 @@ namespace IDE.ui
|
|||
public int32 mClangCommandQueueSize;
|
||||
public DarkComboBox mConfigComboBox;
|
||||
public DarkComboBox mPlatformComboBox;
|
||||
public DarkButton mSafeModeButton;
|
||||
public bool mWasCompiling;
|
||||
public int mEvalCount;
|
||||
public ImageWidget mCancelSymSrvButton;
|
||||
|
@ -36,6 +37,20 @@ namespace IDE.ui
|
|||
mPlatformComboBox.mFrameKind = .Frameless;
|
||||
mPlatformComboBox.mPopulateMenuAction.Add(new => PopulatePlatformMenu);
|
||||
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)
|
||||
|
@ -101,6 +116,11 @@ namespace IDE.ui
|
|||
|
||||
if (mCancelSymSrvButton != null)
|
||||
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue