| 60 | #endif |
| 61 | |
| 62 | FileLinkApp::FileLinkApp(int& argc, char** argv) : QCoreApplication(argc, argv), socket(new QLocalSocket(this)) |
| 63 | { |
| 64 | #if defined Q_OS_WIN32 |
| 65 | // attach the parent console |
| 66 | if (AttachWindowsConsole()) { |
| 67 | consoleAttached = true; |
| 68 | } |
| 69 | #endif |
| 70 | setOrganizationName(BuildConfig.LAUNCHER_NAME); |
| 71 | setOrganizationDomain(BuildConfig.LAUNCHER_DOMAIN); |
| 72 | setApplicationName(BuildConfig.LAUNCHER_NAME + "FileLink"); |
| 73 | setApplicationVersion(BuildConfig.printableVersionString() + "\n" + BuildConfig.GIT_COMMIT); |
| 74 | |
| 75 | // Commandline parsing |
| 76 | QCommandLineParser parser; |
| 77 | parser.setApplicationDescription(QObject::tr("a batch MKLINK program for windows to be used with prismlauncher")); |
| 78 | |
| 79 | parser.addOptions({ { { "s", "server" }, "Join the specified server on launch", "pipe name" }, |
| 80 | { { "H", "hard" }, "use hard links instead of symbolic", "true/false" } }); |
| 81 | parser.addHelpOption(); |
| 82 | parser.addVersionOption(); |
| 83 | |
| 84 | parser.process(arguments()); |
| 85 | |
| 86 | QString serverToJoin = parser.value("server"); |
| 87 | m_useHardLinks = QVariant(parser.value("hard")).toBool(); |
| 88 | |
| 89 | qDebug() << "link program launched"; |
| 90 | |
| 91 | if (!serverToJoin.isEmpty()) { |
| 92 | qDebug() << "joining server" << serverToJoin; |
| 93 | joinServer(serverToJoin); |
| 94 | } else { |
| 95 | qDebug() << "no server to join"; |
| 96 | m_status = Failed; |
| 97 | exit(); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | void FileLinkApp::joinServer(QString server) |
| 102 | { |
nothing calls this directly
no test coverage detected