winemenubuilder: eliminate wineshelllink

Alexandre Julliard julliard at winehq.org
Fri Sep 5 03:45:30 CDT 2008


"Damjan Jovanovic" <damjan.jov at gmail.com> writes:

> @@ -169,6 +170,10 @@ MAKE_FUNCPTR(png_write_info);
>  MAKE_FUNCPTR(png_write_row);
>  #undef MAKE_FUNCPTR
>  
> +static char xdg_config_dir[MAX_PATH];
> +static char xdg_data_dir[MAX_PATH];
> +static char xdg_desktop_dir[MAX_PATH];

MAX_PATH is not appropriate for unix paths, please allocate them
dynamically.

> +        if (filename[i] == '/' && i > 0)
> +        {
> +            struct stat st;
> +            filename[i] = 0;
> +            if (stat(filename, &st) != 0)
> +            {
> +                if (errno == ENOENT)
> +                {
> +                    if (mkdir(filename, 0777))
> +                        ret = FALSE;
> +                }

mkdir fails on existing paths, there's no need to stat first.

> +    snprintf(xpmPath, xpmPathLen, "%s/icons/%s", xdg_data_dir, name);
> +    dot = strrchr(xpmPath, '.');
> +    if (dot != NULL)
> +        *dot = 0;

You should only match a dot in the filename, not in the directory.

> +        dst = fopen(xpmPath, "w");
> +        if (dst)
> +        {
> +            char buffer[8096];

What's with the strange size?

> +    if (getenv("WINEPREFIX"))
> +        snprintf(winePrefix, sizeof(winePrefix), "%s", getenv("WINEPREFIX"));
> +    else
> +        snprintf(winePrefix, sizeof(winePrefix), "%s/.wine", getenv("HOME"));

You want wine_get_config_dir().

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list