| 75 | } |
| 76 | |
| 77 | std::string FindNotepad() { |
| 78 | std::string note; |
| 79 | // 1. Find the path to the 'notepad++.exe' |
| 80 | try { |
| 81 | auto notepad = boost::process::environment::find_executable("notepad++"); |
| 82 | if (!notepad.string().empty()) { |
| 83 | note = notepad.string(); |
| 84 | } |
| 85 | } catch (const std::exception &) { |
| 86 | note.clear(); |
| 87 | } |
| 88 | |
| 89 | if (!note.empty()) { |
| 90 | return note; |
| 91 | } |
| 92 | |
| 93 | // 2. Find the path to the 'notepad.exe' |
| 94 | try { |
| 95 | auto notepad = boost::process::environment::find_executable("notepad"); |
| 96 | if (!notepad.string().empty()) { |
| 97 | note = notepad.string(); |
| 98 | } |
| 99 | } catch (const std::exception &) { |
| 100 | note.clear(); |
| 101 | } |
| 102 | |
| 103 | if (!note.empty()) { |
| 104 | return note; |
| 105 | } |
| 106 | |
| 107 | // 3. Find the path to the 'gedit' GNOME editor |
| 108 | try { |
| 109 | auto notepad = boost::process::environment::find_executable("gedit"); |
| 110 | if (!notepad.string().empty()) { |
| 111 | note = notepad.string(); |
| 112 | } |
| 113 | } catch (const std::exception &) { |
| 114 | note.clear(); |
| 115 | } |
| 116 | return note; |
| 117 | } |
| 118 | |
| 119 | bool BackupFiles(const std::string &filename, bool remove_file) { |
| 120 | if (filename.empty()) { |