| 842 | } |
| 843 | |
| 844 | int ProcessOptions(int argc, char* argv[], Options* options, std::vector<RGBController *>& rgb_controllers) |
| 845 | { |
| 846 | unsigned int ret_flags = 0; |
| 847 | int arg_index = 1; |
| 848 | std::vector<DeviceOptions> current_devices; |
| 849 | |
| 850 | options->hasDevice = false; |
| 851 | options->profile_loaded = false; |
| 852 | |
| 853 | #ifdef _WIN32 |
| 854 | int fake_argc; |
| 855 | wchar_t** argvw = CommandLineToArgvW(GetCommandLineW(), &fake_argc); |
| 856 | #endif |
| 857 | |
| 858 | while(arg_index < argc) |
| 859 | { |
| 860 | std::string option = argv[arg_index]; |
| 861 | std::string argument = ""; |
| 862 | filesystem::path arg_path; |
| 863 | |
| 864 | /*---------------------------------------------------------*\ |
| 865 | | Handle options that take an argument | |
| 866 | \*---------------------------------------------------------*/ |
| 867 | if(arg_index + 1 < argc) |
| 868 | { |
| 869 | argument = argv[arg_index + 1]; |
| 870 | #ifdef _WIN32 |
| 871 | arg_path = argvw[arg_index + 1]; |
| 872 | #else |
| 873 | arg_path = argument; |
| 874 | #endif |
| 875 | } |
| 876 | |
| 877 | /*---------------------------------------------------------*\ |
| 878 | | -l / --list-devices (no arguments) | |
| 879 | \*---------------------------------------------------------*/ |
| 880 | if(option == "--list-devices" || option == "-l") |
| 881 | { |
| 882 | OptionListDevices(rgb_controllers); |
| 883 | exit(0); |
| 884 | } |
| 885 | |
| 886 | /*---------------------------------------------------------*\ |
| 887 | | -d / --device | |
| 888 | \*---------------------------------------------------------*/ |
| 889 | else if(option == "--device" || option == "-d") |
| 890 | { |
| 891 | while(!current_devices.empty()) |
| 892 | { |
| 893 | options->devices.push_back(current_devices.back()); |
| 894 | current_devices.pop_back(); |
| 895 | } |
| 896 | |
| 897 | if(!OptionDevice(¤t_devices, argument, options, rgb_controllers)) |
| 898 | { |
| 899 | return RET_FLAG_PRINT_HELP; |
| 900 | } |
| 901 |
no test coverage detected