mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05: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
|
@ -185,7 +185,7 @@ static void exec_cmd_entry ( DRunModeEntry *e )
|
||||||
}
|
}
|
||||||
|
|
||||||
const gchar *fp = g_strstrip ( str );
|
const gchar *fp = g_strstrip ( str );
|
||||||
gchar *exec_path = g_key_file_get_string ( e->key_file, "Desktop Entry", "Path", NULL );
|
gchar *exec_path = g_key_file_get_string ( e->key_file, "Desktop Entry", "Path", NULL );
|
||||||
if ( exec_path != NULL && strlen ( exec_path ) == 0 ) {
|
if ( exec_path != NULL && strlen ( exec_path ) == 0 ) {
|
||||||
// If it is empty, ignore this property. (#529)
|
// If it is empty, ignore this property. (#529)
|
||||||
g_free ( exec_path );
|
g_free ( exec_path );
|
||||||
|
@ -290,6 +290,28 @@ static gboolean read_desktop_file ( DRunModePrivateData *pd, const char *root, c
|
||||||
g_key_file_free ( kf );
|
g_key_file_free ( kf );
|
||||||
return FALSE;
|
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 );
|
size_t nl = ( ( pd->cmd_list_length ) + 1 );
|
||||||
if ( nl >= pd->cmd_list_length_actual ) {
|
if ( nl >= pd->cmd_list_length_actual ) {
|
||||||
pd->cmd_list_length_actual += 256;
|
pd->cmd_list_length_actual += 256;
|
||||||
|
|
Loading…
Reference in a new issue