From 3a437bb7d5fd6a287a0c679029a9a445404130fd Mon Sep 17 00:00:00 2001 From: yjogol Date: Fri, 9 Sep 2011 18:32:29 +0000 Subject: [PATCH] nhttpd: file API remove last comma for JSON git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1685 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- src/nhttpd/tuxboxapi/coolstream/controlapi.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index e75c5a937..faa91ec63 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -2708,6 +2708,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh) { std::string path = hh->ParamList["path"]; if ((dirp = opendir(path.c_str()))) { + bool isFirstLine = true; while ((entry = readdir(dirp))) { std::string item = ""; item += hh->outPair("name", @@ -2769,7 +2770,11 @@ void CControlAPI::FileCGI(CyhookHandler *hh) { string_printf("%ld", (long) statbuf.st_mtime), false); } - result += hh->outArrayItem("item", item, true); + if(isFirstLine) + isFirstLine = false; + else + result += hh->outNext(); + result += hh->outArrayItem("item", item, false); } closedir(dirp); }