[vlc-devel] [PATCH v3 1/14] core: add config_GetTempPath()
Steve Lhomme
robux4 at ycbcr.xyz
Wed Oct 14 08:17:15 CEST 2020
> diff --git a/src/win32/dirs-uap.c b/src/win32/dirs-uap.c
> index e1c7506961..9bf07fdba5 100644
> --- a/src/win32/dirs-uap.c
> +++ b/src/win32/dirs-uap.c
> @@ -304,3 +304,13 @@ char *config_GetUserDir (vlc_userdir_t type)
> vlc_assert_unreachable ();
> }
> }
> +
> +char *config_GetTempPath(void)
> +{
> + wchar_t wdir[MAX_PATH + 1];
> +
> + DWORD len = GetTempPathW(MAX_PATH + 1, wdir);
> + if (len != 0 && len <= MAX_PATH)
> + return FromWide(wdir);
> + return NULL;
> +}
> diff --git a/src/win32/dirs.c b/src/win32/dirs.c
> index 7c39e391c2..7e3516bc8a 100644
> --- a/src/win32/dirs.c
> +++ b/src/win32/dirs.c
> @@ -168,3 +168,13 @@ char *config_GetUserDir (vlc_userdir_t type)
> }
> vlc_assert_unreachable ();
> }
> +
> +char *config_GetTempPath(void)
> +{
> + wchar_t wdir[MAX_PATH + 1];
> +
> + DWORD len = GetTempPathW(MAX_PATH + 1, wdir);
> + if (len != 0 && len <= MAX_PATH)
> + return FromWide(wdir);
> + return NULL;
> +}
It would be better if this code was not duplicated for different windows
target. You can put it in win32/filesystem.c for example.
More information about the vlc-devel
mailing list