MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / main

Function main

src/server/NymphCastServer.cpp:1709–2249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1707
1708
1709int main(int argc, char** argv) {
1710 // Do locale initialisation here to appease Valgrind (prevent data-race reporting).
1711 std::ostringstream dummy;
1712 dummy << 0;
1713
1714 // Parse the command line arguments.
1715 Sarge sarge;
1716 sarge.setArgument("h", "help", "Get this help message.", false);
1717 sarge.setArgument("a", "apps", "Custom NymphCast apps location.", true);
1718 sarge.setArgument("w", "wallpaper", "Custom NymphCast wallpaper location.", true);
1719 sarge.setArgument("c", "configuration", "Path to configuration file.", true);
1720 sarge.setArgument("r", "resources", "Path to GUI resource folder.", true);
1721 sarge.setArgument("v", "version", "Output the NymphCast version and exit.", false);
1722 sarge.setDescription("NymphCast receiver application. For use with NymphCast clients. More details: http://nyanko.ws/nymphcast.php.");
1723 sarge.setUsage("nymphcast_server <options>");
1724
1725 sarge.parseArguments(argc, argv);
1726
1727 if (sarge.exists("help")) {
1728 sarge.printHelp();
1729 return 0;
1730 }
1731
1732 if (sarge.exists("version")) {
1733 std::cout << "NymphCast version: " << __VERSION << std::endl;
1734 return 0;
1735 }
1736
1737 std::string config_file;
1738 if (!sarge.getFlag("configuration", config_file)) {
1739 std::cerr << "No configuration file provided in command line arguments." << std::endl;
1740 return 1;
1741 }
1742
1743 // Set apps folder. Ensure the path ends with a slash.
1744 appsFolder = "apps/";
1745 if (!sarge.getFlag("apps", appsFolder)) {
1746 std::cout << "Setting app folder to default location." << std::endl;
1747 }
1748
1749 if (appsFolder.back() != '/') {
1750 appsFolder.append("/");
1751 }
1752
1753 // Set wallpapers folder. Ensure the path ends with a flash.
1754 std::string wallpapersFolder = "wallpapers/";
1755 if (!sarge.getFlag("wallpaper", wallpapersFolder)) {
1756 std::cout << "Setting wallpapers folder to default location." << std::endl;
1757 }
1758
1759 if (wallpapersFolder.back() != '/') {
1760 wallpapersFolder.append("/");
1761 }
1762
1763 std::string resourceFolder = "";
1764 if (!sarge.getFlag("resources", resourceFolder)) {
1765 std::cout << "Setting resource folder to default location." << std::endl;
1766 }

Callers

nothing calls this directly

Calls 15

initFunction · 0.85
formatFunction · 0.85
quitFunction · 0.85
appendMethod · 0.80
setAppsFolderMethod · 0.80
readAppListMethod · 0.80
push_backMethod · 0.80
setSpeedMethod · 0.80
moveMethod · 0.80
addOnChangeWidgetMethod · 0.80
setArgumentMethod · 0.45
setDescriptionMethod · 0.45

Tested by

no test coverage detected