Skip to content

Commit

Permalink
fixup notification icon path code
Browse files Browse the repository at this point in the history
1) Don't assume that game_config::path ends in '/'
2) Normalize the path after concatenating '/' + "images/foo.png",
to eliminate the double slashes "//" which apparently confuse dbus
  • Loading branch information
cbeck88 committed Jul 17, 2014
1 parent e8f5a4e commit 5560628
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/desktop/dbus_notification.cpp
Expand Up @@ -15,6 +15,7 @@
#include "dbus_notification.hpp"
#include "global.hpp"

#include "filesystem.hpp"
#include "game_config.hpp"
#include "log.hpp"

Expand Down Expand Up @@ -145,8 +146,14 @@ uint32_t send_dbus_notification(DBusConnection *connection, uint32_t replaces_id
DBUS_TYPE_INVALID);
}

std::string app_icon_ = game_config::path + game_config::images::app_icon;
LOG_DU << "app_icon_=\'" << app_icon_ << "\'\n";
std::string app_icon_ = normalize_path(game_config::path + "/" + game_config::images::app_icon);
if (!file_exists(app_icon_)) {
ERR_DU << "Error: Could not find notification icon.\n"
<< "raw path =\'" << game_config::path << "\' / \'" << game_config::images::app_icon << "\'\n"
<< "normalized path =\'" << app_icon_ << "\'\n";
} else {
LOG_DU << "app_icon_=\'" << app_icon_ << "\'\n";
}

const char *app_icon = app_icon_.c_str();
const char *summary = owner.c_str();
Expand Down

0 comments on commit 5560628

Please sign in to comment.