This repository was archived by the owner on Aug 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGoddessAnimeVersionManager.cpp
More file actions
49 lines (41 loc) · 1.9 KB
/
GoddessAnimeVersionManager.cpp
File metadata and controls
49 lines (41 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*****************************************************************//**
* \file GoddessAnimeVersionManager.cpp
* \brief
* This file contains the implementation of the GoddessAnimeVerionManager class,
* which is responsible for managing the versions of the github repository of the
* Goddess Anime project.
* \author 0xhylia
* \date July 2023
*********************************************************************/
#include <iostream> // For input/output operations
#include <cstdlib> // For system() function
#include <string> // For string manipulation
int main(int argc, char* argv[]) {
if (argc != 2) {
std::cout << "Usage: " << argv[0] << " <tag>" << std::endl; // Print usage if the program is not provided with exactly one command-line argument
return 1; // Exit the program with an error code
}
std::string arg1(argv[1]); // Store the command-line argument in a string variable
std::string url = "https://update-goddess.hylia.dev/tag/" + arg1; // Create the URL by concatenating the argument with a base URL
std::string command;
#ifdef _WIN32
// Windows command to open default browser
command = "start ";
#elif __APPLE__
// macOS command to open default browser
command = "open ";
#else
// Linux command to open default browser
command = "xdg-open ";
#endif
command += url; // Append the URL to the command
// Execute the command to open the default browser
if (system(command.c_str()) == 0) { // Execute the command and check the return value
std::cout << "Redirecting to " << url << std::endl; // Print the URL if the command executed successfully
}
else {
std::cerr << "Failed to open the default browser." << std::endl; // Print an error message if the command execution failed
return 1; // Exit the program with an error code
}
return 0; // Exit the program successfully
}