Let --launch [type] load program without parameters

This commit is contained in:
Sanel Zukan 2011-10-25 14:30:29 +00:00
parent c0f1ca1c44
commit 05af3ba7f0

View File

@ -304,7 +304,7 @@ static bool start_desktop_file(const char *cmd) {
} }
char buf[PATH_MAX]; char buf[PATH_MAX];
if(d.exec(buf, PATH_MAX)) { if(!d.exec(buf, PATH_MAX)) {
alert(_("Unable to run '%s'.\nProbably this file is malformed or 'Exec' key has non-installed program"), cmd); alert(_("Unable to run '%s'.\nProbably this file is malformed or 'Exec' key has non-installed program"), cmd);
goto FAIL; goto FAIL;
} }
@ -544,8 +544,8 @@ int main(int argc, char** argv) {
return 1; return 1;
} }
/* make sure we have something to run */ /* make sure we have something to run but only if --launch isn't used */
if(!argv[ca]) { if(!argv[ca] && !launch_type) {
puts("Missing execution parameter(s). Run program with '-h' to see options"); puts("Missing execution parameter(s). Run program with '-h' to see options");
return 1; return 1;
} }
@ -560,7 +560,7 @@ int main(int argc, char** argv) {
} }
/* check if we have .desktop file */ /* check if we have .desktop file */
if(str_ends(argv[ca], ".desktop")) if(argv[ca] && str_ends(argv[ca], ".desktop"))
return RETURN_FROM_BOOL(start_desktop_file(argv[ca])); return RETURN_FROM_BOOL(start_desktop_file(argv[ca]));
/* make arguments and exec program */ /* make arguments and exec program */