From: Andy Green Date: Mon, 1 Nov 2010 09:20:48 +0000 (+0000) Subject: test-assets-into-usr-share.patch X-Git-Tag: upstream/1.7.3~1499 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3138e448264056a34c0d9caaa8cb77eac8450cac;p=platform%2Fupstream%2Flibwebsockets.git test-assets-into-usr-share.patch Signed-off-by: Andy Green --- diff --git a/test-server/Makefile b/test-server/Makefile index 61a6a98..18dc56d 100644 --- a/test-server/Makefile +++ b/test-server/Makefile @@ -10,5 +10,7 @@ clean: install: cp -f libwebsockets-test-server $(DESTDIR)/usr/bin + mkdir -p $(DESTDIR)/usr/share/libwebsockets-test-server + cp -f favicon.ico test.html $(DESTDIR)/usr/share/libwebsockets-test-server diff --git a/test-server/test-server.c b/test-server/test-server.c index 2245a67..b4d0ef7 100644 --- a/test-server/test-server.c +++ b/test-server/test-server.c @@ -14,6 +14,7 @@ * Shows how to use libwebsocket */ +#define LOCAL_RESOURCE_PATH "/usr/share/libwebsockets-test-server" static int port = 7681; static int ws_protocol = 76; @@ -102,16 +103,16 @@ static int websocket_callback(struct libwebsocket * wsi, uri = libwebsocket_get_uri(wsi); if (uri && strcmp(uri, "/favicon.ico") == 0) { - if (libwebsockets_serve_http_file(wsi, "./favicon.ico", - "image/x-icon")) + if (libwebsockets_serve_http_file(wsi, + LOCAL_RESOURCE_PATH"/favicon.ico", "image/x-icon")) fprintf(stderr, "Failed to send favicon\n"); break; } /* send the script... when it runs it'll start websockets */ - if (libwebsockets_serve_http_file(wsi, "./test.html", - "text/html")) + if (libwebsockets_serve_http_file(wsi, + LOCAL_RESOURCE_PATH"/test.html", "text/html")) fprintf(stderr, "Failed to send HTTP file\n"); break;