Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnovak committed Jul 17, 2024
1 parent 42117cd commit d821f32
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions src/platform/windows/ipc.nim
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import std/options
import std/os
import std/strformat
import std/typedthreads

import winim/lean

Expand Down Expand Up @@ -167,9 +166,9 @@ proc initClient*(): bool =
return false

if paramCount() == 0:
ipc.sendFocusMessage()
sendFocusMessage()
else:
ipc.sendOpenFileMessage(paramStr(1))
sendOpenFileMessage(paramStr(1))

result = true

Expand Down Expand Up @@ -212,24 +211,23 @@ proc shutdownServer*() =

# {{{ Test
when isMainModule:
when defined(windows):
import std/os
import std/os

echo "Starting..."
if ipc.isAppRunning():
echo "*** CLIENT ***"
if initClient():
ipc.sendOpenFileMessage("quixotic")
ipc.shutdown()
echo "Starting..."
if isAppRunning():
echo "*** CLIENT ***"
if initClient():
sendOpenFileMessage("quixotic")
shutdown()

else:
if ipc.initServer():
echo "*** SERVER ***"
while true:
let msg = tryRecv()
if msg.isSome:
echo msg.get
sleep(100)
else:
if initServer():
echo "*** SERVER ***"
while true:
let msg = tryRecv()
if msg.isSome:
echo msg.get
sleep(100)

# }}}

Expand Down

0 comments on commit d821f32

Please sign in to comment.