Skip to content

Commit

Permalink
introduce a new commandline argument -open for opening files without …
Browse files Browse the repository at this point in the history
…running the CLI. Use that for file associations in the installer. This separation is necessary in order to be able to open TEN files, which currently cannot be imported using the CLI #94
  • Loading branch information
jamaa committed Jun 4, 2023
1 parent 1c9af13 commit 613df0f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
8 changes: 4 additions & 4 deletions setup/Wave.Setup.vdproj
Original file line number Diff line number Diff line change
Expand Up @@ -1719,7 +1719,7 @@
{
"Command" = "8:&Open"
"Verb" = "8:open"
"Arguments" = "8:-import \"%1\""
"Arguments" = "8:-open \"%1\""
"Order" = "3:0"
}
}
Expand All @@ -1742,7 +1742,7 @@
{
"Command" = "8:&Open"
"Verb" = "8:open"
"Arguments" = "8:-import \"%1\""
"Arguments" = "8:-open \"%1\""
"Order" = "3:0"
}
}
Expand Down Expand Up @@ -1801,7 +1801,7 @@
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:BlueM.Wave"
"ProductCode" = "8:{19F0C057-05CB-4914-BACA-D48BC93A167E}"
"PackageCode" = "8:{4E80558B-0CC7-495E-AD83-B97706A3EE60}"
"PackageCode" = "8:{CB883FCB-FE1F-4FD0-9347-BA004EA43E4B}"
"UpgradeCode" = "8:{8AC270DC-0E8D-4087-98AB-3A2C358096B9}"
"AspNetVersion" = "8:2.0.50727.0"
"RestartWWWService" = "11:FALSE"
Expand Down Expand Up @@ -2387,7 +2387,7 @@
{
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_152A841758E942AE8286A4A2A0CCDD82"
{
"SourcePath" = "8:..\\source\\obj\\x64\\Release\\Wave.exe"
"SourcePath" = "8:..\\source\\obj\\x64\\Debug\\Wave.exe"
"TargetName" = "8:"
"Tag" = "8:"
"Folder" = "8:_1335334A1EB042F3AB241758004683C2"
Expand Down
33 changes: 23 additions & 10 deletions source/Main.vb
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,34 @@ Friend Module Main
Application.SetCompatibleTextRenderingDefault(False)

Dim wave As New Wave()

If Environment.GetCommandLineArgs().Count > 1 Then
'run the CLI
Dim showWave As Boolean = False
Using cli As New CLI()
showWave = cli.Run(Environment.GetCommandLineArgs().Skip(1).ToList, wave)
End Using

If Not showWave Then
Exit Sub
Dim args As List(Of String) = Environment.GetCommandLineArgs().Skip(1).ToList()
Dim files As New List(Of String)

If args.Count > 0 Then
If args.First() = "-open" Then
'don't run the CLI, instead collect filenames to open in the app
For Each file As String In args.Skip(1)
files.Add(file)
Next
Else
'run the CLI
Dim showWave As Boolean = False
Using cli As New CLI()
showWave = cli.Run(args, wave)
End Using

If Not showWave Then
Exit Sub
End If
End If
End If

'launch the app
Dim app As New App(wave)
'open any files that were passed with -open argument
For Each file As String In files
wave.Import_File(file)
Next
Application.Run(app)

End Sub
Expand Down

0 comments on commit 613df0f

Please sign in to comment.