Use same style for optional and avoid double check

I did not know that `std::optional::value()` did checked access. And I
still prefer a more explicit .has_value() over boolean conversion, but
this seems to be the accepted way to do this.
This commit is contained in:
Robbert van der Helm
2020-06-05 22:27:04 +02:00
parent ff298f3f46
commit 33777d2876
7 changed files with 35 additions and 36 deletions
+2 -2
View File
@@ -57,7 +57,7 @@ std::string create_logger_prefix(const fs::path& socket_path) {
std::optional<fs::path> find_wineprefix() {
std::optional<fs::path> dosdevices_dir =
find_dominating_file("dosdevices", find_vst_plugin(), fs::is_directory);
if (!dosdevices_dir.has_value()) {
if (!dosdevices_dir) {
return std::nullopt;
}
@@ -276,7 +276,7 @@ bp::environment set_wineprefix() {
}
const auto wineprefix_path = find_wineprefix();
if (wineprefix_path.has_value()) {
if (wineprefix_path) {
env["WINEPREFIX"] = wineprefix_path->string();
}