Skip to content

Commit

Permalink
Workaround for #40
Browse files Browse the repository at this point in the history
  • Loading branch information
trizen committed Aug 10, 2021
1 parent 094883e commit 6901b02
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions obmenu-generator
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/perl

# Copyright (C) 2010-2020 Daniel "Trizen" Șuteu <echo dHJpemVuQHByb3Rvbm1haWwuY29tCg== | base64 -d>.
# Copyright (C) 2010-2021 Daniel "Trizen" Șuteu <echo dHJpemVuQHByb3Rvbm1haWwuY29tCg== | base64 -d>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -24,7 +24,7 @@
# Name: obmenu-generator
# License: GPLv3
# Created: 25 March 2011
# Latest edit: 03 December 2020
# Latest edit: 10 August 2021
# https://github.com/trizen/obmenu-generator

use 5.014;
Expand Down Expand Up @@ -450,7 +450,7 @@ if ($with_icons) {
$cache_db{__GTKRC_MTIME__} = $gtkrc_mtime;
}
else {
my $old_mtime = $cache_db{__GTKRC_MTIME__} // -1;
my $old_mtime = exists($cache_db{__GTKRC_MTIME__}) ? $cache_db{__GTKRC_MTIME__} : -1;
if ($old_mtime != $gtkrc_mtime) {
print STDERR ":: Regenerating the cache DB...\n";

Expand All @@ -469,7 +469,11 @@ if ($with_icons) {
my %fast_cache;

sub check_icon {
$fast_cache{$_[0] // return undef} //= ($cache_db{$_[0]} //= get_icon_path($_[0]));
$fast_cache{$_[0] // return undef} //= do {
exists($cache_db{$_[0]})
? $cache_db{$_[0]}
: do { $cache_db{$_[0]} = get_icon_path($_[0]) }
};
}
}

Expand All @@ -489,7 +493,7 @@ MENU
my %categories;
foreach my $file ($desk_obj->get_desktop_files) {

my %info = split("\0\1\0", $cache_db{$file} // '', -1);
my %info = split("\0\1\0", (exists($cache_db{$file}) ? $cache_db{$file} : ''), -1);

next if exists $info{__IGNORE__};

Expand Down

0 comments on commit 6901b02

Please sign in to comment.