MCPcopy Create free account
hub / github.com/KikoPlayProject/KikoPlay / Router

Method Router

LANServer/router.cpp:9–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include <QCoreApplication>
8
9Router::Router(QObject *parent) : stefanfrings::HttpRequestHandler(parent)
10{
11 apiHandler = new APIHandler(this);
12 fileHandler = new FileHandler(this);
13 const QString strApp(QCoreApplication::applicationDirPath()+"/web");
14#ifdef CONFIG_UNIX_DATA
15 const QString strHome(QDir::homePath()+"/.config/kikoplay/web");
16 const QString strSys("/usr/share/kikoplay/web");
17
18 const QFileInfo fileinfoHome(strHome);
19 const QFileInfo fileinfoSys(strSys);
20 const QFileInfo fileinfoApp(strApp);
21
22 if (fileinfoHome.exists() || fileinfoHome.isDir()) {
23 fileHandler->setRoot(strHome);
24 } else if (fileinfoSys.exists() || fileinfoSys.isDir()) {
25 fileHandler->setRoot(strSys);
26 } else {
27 fileHandler->setRoot(strApp);
28 }
29#else
30 fileHandler->setRoot(strApp);
31#endif
32}
33
34void Router::service(stefanfrings::HttpRequest &request, stefanfrings::HttpResponse &response)
35{

Callers

nothing calls this directly

Calls 3

existsMethod · 0.80
isDirMethod · 0.80
setRootMethod · 0.45

Tested by

no test coverage detected