mirror of
https://github.com/davatorium/rofi.git
synced 2025-07-31 21:59:25 -04:00
Add try exec test (#620)
* Add try exec test * [DRun] Free after g_find_program_in_path
This commit is contained in:
parent
b3caeac38e
commit
c7e8776c78
1 changed files with 23 additions and 1 deletions
|
@ -290,6 +290,28 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
|
|||
g_key_file_free ( kf );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( g_key_file_has_key ( kf, "Desktop Entry", "TryExec", NULL ) ) {
|
||||
char *te = g_key_file_get_string ( kf, "Desktop Entry", "TryExec", NULL );
|
||||
if ( !g_path_is_absolute ( te ) ) {
|
||||
char *fp = g_find_program_in_path ( te );
|
||||
if ( fp == NULL ) {
|
||||
g_free ( te );
|
||||
g_key_file_free ( kf );
|
||||
return FALSE;
|
||||
}
|
||||
g_free ( fp );
|
||||
}
|
||||
else {
|
||||
if ( g_file_test ( te, G_FILE_TEST_IS_EXECUTABLE ) == FALSE ) {
|
||||
g_free ( te );
|
||||
g_key_file_free ( kf );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
g_free ( te );
|
||||
}
|
||||
|
||||
size_t nl = ( ( pd->cmd_list_length ) + 1 );
|
||||
if ( nl >= pd->cmd_list_length_actual ) {
|
||||
pd->cmd_list_length_actual += 256;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue