Skip to content

Commit

Permalink
chore
Browse files Browse the repository at this point in the history
  • Loading branch information
yuto-trd committed Aug 19, 2023
1 parent 00f5585 commit ff082e9
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/Beutl.Api/Services/CoreLibraries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,16 @@ public static IEnumerable<Dependency> CollectRuntimeDependencies()
case "Beutl.Utilities":
case "Beutl.WaitingDialog":
case "bpt":
case "Beutl.ExceptionHandler":
version = assembly.GetName().Version!.ToString();
break;
default:
break;
}
}

library.Add(new Dependency(fileName, version!));
if (version != null)
library.Add(new Dependency(fileName, version));
}
}
}
Expand Down
22 changes: 22 additions & 0 deletions src/Beutl.PackageTools/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.CommandLine;
using System.Diagnostics;

using Beutl.PackageTools;
using Beutl.PackageTools.Properties;
Expand All @@ -23,18 +24,39 @@
{
IsHidden = true,
};
var launchDebugger = new Option<bool>("--launch-debugger", () => false)
{
IsHidden = true,
};

var rootCommand = new RunCommand(apiApp, verbose, clean);
rootCommand.AddGlobalOption(verbose);
rootCommand.AddGlobalOption(clean);
rootCommand.AddGlobalOption(stayOpen);
rootCommand.AddGlobalOption(launchDebugger);
rootCommand.AddCommand(new InstallCommand(apiApp, verbose, clean));
rootCommand.AddCommand(new UninstallCommand(apiApp, verbose, clean));
rootCommand.AddCommand(new UpdateCommand(apiApp, verbose, clean));
rootCommand.AddCommand(new CleanCommand(apiApp));
rootCommand.AddCommand(new ListCommand(apiApp, verbose));

bool stayOpenValue = rootCommand.Parse(args).GetValueForOption(stayOpen);
bool launchDebuggerValue = rootCommand.Parse(args).GetValueForOption(launchDebugger);

#if DEBUG
if (!Debugger.IsAttached && launchDebuggerValue)
{
while (true)
{
Thread.Sleep(100);

if (Debugger.Launch())
break;
}
}
#endif


await rootCommand.InvokeAsync(args);

if (stayOpenValue)
Expand Down
1 change: 1 addition & 0 deletions src/Beutl/Beutl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<ProjectReference Include="..\Beutl.Controls\Beutl.Controls.csproj" />
<ProjectReference Include="..\Beutl.PackageTools\Beutl.PackageTools.csproj" />
<ProjectReference Include="..\Beutl.WaitingDialog\Beutl.WaitingDialog.csproj" />
<ProjectReference Include="..\Beutl.ExceptionHandler\Beutl.ExceptionHandler.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(FFmpegBuildIn)'=='True'">
Expand Down
5 changes: 4 additions & 1 deletion src/Beutl/Services/UnhandledExceptionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ private static void OnUnhandledException(object sender, UnhandledExceptionEventA

PrivateExit();

Process.Start(new ProcessStartInfo(Path.Combine(AppContext.BaseDirectory, "Beutl.ExceptionHandler"))
string exePath = Path.Combine(
AppContext.BaseDirectory,
OperatingSystem.IsWindows() ? "Beutl.ExceptionHandler.exe" : "Beutl.ExceptionHandler");
Process.Start(new ProcessStartInfo(exePath)
{
UseShellExecute = true,
});
Expand Down
5 changes: 4 additions & 1 deletion src/Beutl/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ private void OnExit(object? sender, ControlledApplicationLifetimeExitEventArgs e

if (installs.Length > 0 || uninstalls.Length > 0)
{
var startInfo = new ProcessStartInfo(Path.Combine(AppContext.BaseDirectory, "bpt"))
var startInfo = new ProcessStartInfo(Path.Combine(AppContext.BaseDirectory, OperatingSystem.IsWindows() ? "bpt.exe" : "bpt"))
{
UseShellExecute = true,
};
Expand All @@ -550,6 +550,9 @@ private void OnExit(object? sender, ControlledApplicationLifetimeExitEventArgs e
startInfo.ArgumentList.Add("--verbose");
startInfo.ArgumentList.Add("--stay-open");

if (Debugger.IsAttached)
startInfo.ArgumentList.Add("--launch-debugger");

Process.Start(startInfo);
}
}
Expand Down

0 comments on commit ff082e9

Please sign in to comment.