diff options
| author | Michael Vetter <jubalh@iodoru.org> | 2018-11-10 08:36:15 +0100 |
|---|---|---|
| committer | Michael Vetter <jubalh@iodoru.org> | 2018-11-10 08:36:15 +0100 |
| commit | 80dbe636cd647c48b36db8df70708b4bc5ca1d6f (patch) | |
| tree | ce964279a551d3942ea66ed4e8d9157adc467fa8 /src | |
| parent | 4c83cee8108e5d56d142117512d1e4bc017b7180 (diff) | |
| download | raylib-80dbe636cd647c48b36db8df70708b4bc5ca1d6f.tar.gz raylib-80dbe636cd647c48b36db8df70708b4bc5ca1d6f.zip | |
core: OpenURL() fix xdg-open call
Calling just `xdg-open` is not right. One needs to pack the URL in `'`.
If we don't do this then some special characters (like ampersand) will
be executed.
Maybe this is true for Windows and Apple case too, but I don't own any
such system. So please merge this, and if it's true for more cases let's
use `sprintf()` in the other cases too.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1823,14 +1823,17 @@ int StorageLoadValue(int position) void OpenURL(const char *url) { char *cmd = calloc(10 + strlen(url), sizeof(char)); + #if defined(_WIN32) strcpy(cmd, "explorer "); + strcat(cmd, url); #elif defined(__linux__) - strcpy(cmd, "xdg-open "); // Alternatives: firefox, x-www-browser + sprintf(cmd, "xdg-open '%s'", url); // Alternatives: firefox, x-www-browser #elif defined(__APPLE__) strcpy(cmd, "open "); -#endif strcat(cmd, url); +#endif + system(cmd); free(cmd); } |
