apply layout (replace config.cfg content) v 1.2.9
| 75 | |
| 76 | // apply layout (replace config.cfg content) v 1.2.9 |
| 77 | void ApplyLayout(const string& layoutName) { |
| 78 | string sourcePath = "meta\\profiles\\" + layoutName + ".cfg"; |
| 79 | string destPath = "config.cfg"; |
| 80 | |
| 81 | ifstream src(sourcePath, ios::binary); |
| 82 | ofstream dst(destPath, ios::binary | ios::trunc); |
| 83 | |
| 84 | if (!src.is_open() || !dst.is_open()) { |
| 85 | MessageBox(NULL, TEXT("Failed to apply layout. Please check the layout file."), |
| 86 | TEXT("SnapKey Error"), MB_ICONERROR | MB_OK); |
| 87 | return; |
| 88 | } |
| 89 | |
| 90 | dst << src.rdbuf(); // copy file contents |
| 91 | } |
| 92 | |
| 93 | // restart |
| 94 | void RestartSnapKey() { |