gtk/controller: build win32 controller pipe name

This commit is contained in:
Marc-André Lureau 2011-06-10 21:09:52 +02:00
parent d9e75a6c95
commit 62abefbb4a
2 changed files with 10 additions and 0 deletions

View File

@ -15,6 +15,7 @@
using GLib;
using Custom;
using Win32;
using Spice;
using SpiceProtocol;
@ -217,7 +218,11 @@ public class SpiceController: Object {
public async void listen (string? addr = null) throws GLib.Error, ControllerError
{
if (addr == null)
#if WIN32
addr = (string*)"\\\\.\\pipe\\SpiceController-%lu".printf (GetCurrentProcessId ());
#else
addr = (string*)"%s".printf (Environment.get_variable ("SPICE_XPI_SOCKET")); // FIXME vala...
#endif
if (addr == null)
throw new ControllerError.VALUE ("Missing SPICE_XPI_SOCKET");
FileUtils.unlink (addr);

View File

@ -24,3 +24,8 @@ namespace Spice {
public void add_named_pipe (NamedPipe namedpipe);
}
}
namespace Win32 {
[CCode (cheader_filename = "windows.h", cname = "GetCurrentProcessId")]
public uint32 GetCurrentProcessId ();
}