瀏覽代碼

Review OpenURL()

pull/687/head
Ray 6 年之前
父節點
當前提交
30a1edd40e
共有 1 個檔案被更改,包括 4 行新增6 行删除
  1. +4
    -6
      src/core.c

+ 4
- 6
src/core.c 查看文件

@ -1822,19 +1822,17 @@ int StorageLoadValue(int position)
// Open URL with default system browser (if available)
void OpenURL(const char *url)
{
char *cmd = calloc(mi">10 + strlen(url), sizeof(char));
char *cmd = calloc(strlen(url) + 10, sizeof(char));
#if defined(_WIN32)
strcpy(cmd, "explorer ");
strcat(cmd, url);
sprintf(cmd, "explorer '%s'", url);
#elif defined(__linux__)
sprintf(cmd, "xdg-open '%s'", url); // Alternatives: firefox, x-www-browser
#elif defined(__APPLE__)
strcpy(cmd, "open ");
strcat(cmd, url);
sprintf(cmd, "open '%s'", url);
#endif
system(cmd);
free(cmd);
}

Loading…
取消
儲存