Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Fix for loading the icon list in Linux #483

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

radorodopski
Copy link
Contributor

This commit fixes a couple of things:
1. The list of icons was using relative paths.
2. If the icons could not be loaded, the error was ignored without a warning.

For 1) I am prefixing the icon paths with the directory where the Brackets executable resides (since the icons are there, too).
One might think that the paths are relative to the aforementioned directory, except that is only true if Brackets is started from the launcher. If I start Brackets from the command line (or if I specify another initial working dir), Brackets fails to load the icons.
On top of that, no warning is issued to the user, making this hard to trace as my window manager cached the icons (so for testing I had to rename the executable, too). Which leads me to 2), now I'm issuing a warning if Brackets fails to load any of the icons.
The bug was originally pointed out to me by another user - @orschiro on github.

Here's what it looks like:
icon_bug_cropped

To reproduce the issue:

  1. Start a terminal
  2. cd ~/
  3. sudo cp /opt/brackets/Brackets /opt/brackets/test1
  4. /opt/brackets/test1

Running the copy of the Brackets executable from 4) is necessary in order to bypass any cache the window manager might have.

This commit fixes a couple of things:
    1. The list of icons was using relative paths.
    2. If the icons could not be loaded, the error was ignored without a warning.

For adobe#1 I am prefixing the icon paths with the directory where the Brackets executable resides (since the icons are there, too).
One might think that the paths are relative to the aforementioned directory, except that is only true if Brackets is started from the launcher. If I start Brackets from the command line (or if I specify another initial working dir), Brackets fails to load the icons.
On top of that, no warning is issued to the user, making this hard to trace as my window manager cached the icons (so for testing I had to rename the executable, too). Which leads me to adobe#2, now I'm issuing a warning if Brackets fails to load any of the icons.
The bug was originally pointed out to me by another user - @orschiro on github.
@radorodopski
Copy link
Contributor Author

This should fix adobe/brackets#7141

GError *error = NULL;
std::string running_dir = AppGetRunningDirectory();
gchar *iconpath = g_strdup_printf("%s/%s", running_dir.c_str(), icons[i].c_str());
GdkPixbuf *icon = gdk_pixbuf_new_from_file(iconpath, &error);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if iconpath is NULL or not. If it is NULL continue.

@nethip
Copy link
Contributor

nethip commented Mar 16, 2015

@radorodopski Did you get a chance to look at the suggested changes?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants