Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
3ec13a46 by Steve Lhomme at 2026-02-10T10:39:59+00:00
win32: dirs: handle VLC_PKG_LIBEXEC_DIR properly

It should return the folder where private executables are.

For an installed/packaged VLC on Windows that's the root of the VLC folder,
where vlc-cache-gen.exe is, which is the same folder as vlc.exe. For libvlc
users that should be the same although it's not guaranteed.

- - - - -
48eb3c22 by Steve Lhomme at 2026-02-10T10:39:59+00:00
win32: dirs-uap: handle VLC_PKG_LIB_DIR/VLC_PKG_LIBEXEC_DIR

This is the same implementation as in desktop Windows.

GetModuleFileNameW [^1] and VirtualQuery [^2] are available in UWP.

[^1]: 
https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamew#requirements
[^2]: 
https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualquery#requirements

- - - - -
7c04139d by Steve Lhomme at 2026-02-10T10:39:59+00:00
win32: dirs: handle VLC_LIBEXEC_PATH when VLC_PKG_LIBEXEC_DIR is requested

It's undocumented but was mapped the same way in 
e23555302f928e3ad750e2c8c8960ccf9ecffd58.

- - - - -
f16d1f3c by Steve Lhomme at 2026-02-10T10:39:59+00:00
dirs-uap: handle VLC_LIBEXEC_PATH when VLC_PKG_LIBEXEC_DIR is requested

It's undocumented but was mapped the same way in 
e23555302f928e3ad750e2c8c8960ccf9ecffd58.

- - - - -
e58becde by Steve Lhomme at 2026-02-10T10:39:59+00:00
win32: dirs: factorize common code to get VLC folders

These functions use the same code on both variants of Windows:
- config_GetSysPath()
- config_GetLibDir()

These functions are not the same:
- platform_GetUserDir()

They are all internal to the core.

- - - - -
d5572777 by Steve Lhomme at 2026-02-10T10:39:59+00:00
dirs-uap: assume IApplicationData2 is always present

We require mingw-w64 v8 since e5725fe5cd0f6a0220d247312ee4089f6f9f1e73 which
has it properly defined.

And HAVE___X_ABI_CWINDOWS_CSTORAGE_CIAPPLICATIONDATA2 was not defined in meson.

- - - - -


6 changed files:

- configure.ac
- src/Makefile.am
- src/meson.build
- + src/win32/dirs-common.c
- src/win32/dirs-uap.c
- src/win32/dirs.c


Changes:

=====================================
configure.ac
=====================================
@@ -2773,36 +2773,6 @@ dnl
 AC_CHECK_HEADERS([dxgidebug.h])
 AC_CHECK_HEADERS([d3dx9effect.h])
 
-dnl
-dnl IStorageFolder
-dnl
-AS_IF([test "$vlc_winstore_app" = "1"],
-[
-    AC_MSG_CHECKING([for proper __x_ABI_CWindows_CStorage_CIStorageFolder 
definition])
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include <windows.storage.h>
-__x_ABI_CWindows_CStorage_CIStorageFolder *toto;
-    ]])], [
-        AC_MSG_RESULT([yes])
-    ], [
-        AC_MSG_RESULT([no])
-        AC_MSG_ERROR([IStorageFolder not properly defined, use mingw-w64 8.0.1 
or higher])
-    ])
-
-    AC_MSG_CHECKING([for proper __x_ABI_CWindows_CStorage_CIApplicationData2 
definition])
-    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#include <windows.storage.h>
-__x_ABI_CWindows_CStorage_CIApplicationData2 *toto;
-    ]])], [
-        AC_MSG_RESULT([yes])
-        have_iapplication_data2="yes"
-    ], [
-        AC_MSG_RESULT([no])
-    ])
-])
-
-AM_CONDITIONAL([HAVE_WINDOWS_STORAGE], [test "${have_iapplication_data2}" = 
"yes"])
-
 dnl
 dnl  avformat demuxer/muxer plugin
 dnl


=====================================
src/Makefile.am
=====================================
@@ -448,6 +448,7 @@ libvlccore_la_CPPFLAGS = $(AM_CPPFLAGS) 
$(CPPFLAGS_libvlccore)
 
 if HAVE_WIN32
 libvlccore_la_SOURCES += \
+       win32/dirs-common.c \
        win32/error.c \
        win32/filesystem.c \
        win32/netconf.c \


=====================================
src/meson.build
=====================================
@@ -341,6 +341,7 @@ if host_system == 'darwin'
     endif
 elif host_system == 'windows'
     libvlccore_sources += [
+        'win32/dirs-common.c',
         'win32/error.c',
         'win32/filesystem.c',
         'win32/netconf.c',


=====================================
src/win32/dirs-common.c
=====================================
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * dirs-common.c: directories configuration
+ *****************************************************************************
+ * Copyright (C) 2001-2010 VLC authors and VideoLAN
+ * Copyright © 2007-2012 Rémi Denis-Courmont
+ *
+ * Authors: Gildas Bazin <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_charset.h> // FromWide
+#include "../config/configuration.h"
+
+#include <windows.h>
+#include <assert.h>
+
+
+char *config_GetLibDir (void)
+{
+    /* Get our full path */
+    MEMORY_BASIC_INFORMATION mbi;
+    if (!VirtualQuery (config_GetLibDir, &mbi, sizeof(mbi)))
+        goto error;
+
+    wchar_t wpath[MAX_PATH];
+    if (!GetModuleFileNameW ((HMODULE) mbi.AllocationBase, wpath, MAX_PATH))
+        goto error;
+
+    wchar_t *file = wcsrchr (wpath, L'\\');
+    if (file == NULL)
+        goto error;
+    *file = L'\0';
+
+    return FromWide (wpath);
+error:
+    abort ();
+}
+
+static char *config_GetLibexecDir (void)
+{
+    wchar_t wpath[MAX_PATH];
+    if (!GetModuleFileNameW (NULL, wpath, MAX_PATH))
+        goto error;
+
+    wchar_t *file = wcsrchr (wpath, L'\\');
+    if (file == NULL)
+        goto error;
+    *file = L'\0';
+
+    return FromWide (wpath);
+error:
+    abort ();
+}
+
+static char *config_GetDataDir(void)
+{
+    const char *path = getenv ("VLC_DATA_PATH");
+    return (path != NULL) ? strdup (path) : config_GetLibDir ();
+}
+
+char *config_GetSysPath(vlc_sysdir_t type, const char *filename)
+{
+    char *dir = NULL;
+
+    switch (type)
+    {
+        case VLC_PKG_DATA_DIR:
+            dir = config_GetDataDir();
+            break;
+        case VLC_PKG_LIB_DIR:
+            dir = getenv ("VLC_LIB_PATH");
+            if (dir)
+                return strdup( dir );
+            dir = config_GetLibDir();
+            break;
+        case VLC_PKG_LIBEXEC_DIR:
+            dir = getenv ("VLC_LIBEXEC_PATH");
+            if (dir)
+                return strdup( dir );
+            dir = config_GetLibexecDir();
+            break;
+        case VLC_SYSDATA_DIR:
+            break;
+        case VLC_LOCALE_DIR:
+            dir = config_GetSysPath(VLC_PKG_DATA_DIR, "locale");
+            break;
+        default:
+            vlc_assert_unreachable();
+    }
+
+    if (filename == NULL || unlikely(dir == NULL))
+        return dir;
+
+    char *path;
+    if (unlikely(asprintf(&path, "%s\\%s", dir, filename) == -1))
+        path = NULL;
+    free(dir);
+    return path;
+}


=====================================
src/win32/dirs-uap.c
=====================================
@@ -28,11 +28,7 @@
 #define COBJMACROS
 #define INITGUID
 
-#ifndef UNICODE
-#define UNICODE
-#endif
 #include <vlc_common.h>
-#include <vlc_configuration.h>
 #include "../config/configuration.h"
 
 #include <vlc_charset.h>
@@ -153,49 +149,6 @@ end_other:
     return GetFolderName(folder);
 }
 
-static char *config_GetDataDir(void)
-{
-    const char *path = getenv ("VLC_DATA_PATH");
-    return (path != NULL) ? strdup (path) : NULL;
-}
-
-char *config_GetSysPath(vlc_sysdir_t type, const char *filename)
-{
-    char *dir = NULL;
-
-    switch (type)
-    {
-        case VLC_PKG_DATA_DIR:
-            dir = config_GetDataDir();
-            break;
-        case VLC_PKG_LIB_DIR:
-            dir = getenv ("VLC_LIB_PATH");
-            if (dir)
-                return strdup( dir );
-            /* fallthrough */
-        case VLC_PKG_LIBEXEC_DIR:
-        case VLC_SYSDATA_DIR:
-            return NULL;
-        case VLC_LOCALE_DIR:
-            dir = config_GetSysPath(VLC_PKG_DATA_DIR, "locale");
-            break;
-        default:
-            vlc_assert_unreachable();
-    }
-
-    if (unlikely(dir == NULL))
-        return NULL;
-
-    if (filename == NULL)
-        return dir;
-
-    char *path;
-    if (unlikely(asprintf(&path, "%s\\%s", dir, filename) == -1))
-        path = NULL;
-    free(dir);
-    return path;
-}
-
 static char *config_GetAppDir (void)
 {
     char *psz_dir = NULL;
@@ -256,7 +209,6 @@ end_appdata:
     return psz_dir;
 }
 
-#ifdef HAVE___X_ABI_CWINDOWS_CSTORAGE_CIAPPLICATIONDATA2
 static char *config_GetCacheDir (void)
 {
     HRESULT hr;
@@ -317,12 +269,6 @@ end_appdata:
 
     return GetFolderName(folder);
 }
-#else
-static inline char *config_GetCacheDir(void)
-{
-    return config_GetAppDir();
-}
-#endif // HAVE___X_ABI_CWINDOWS_CSTORAGE_CIAPPLICATIONDATA2
 
 char *platform_GetUserDir (vlc_userdir_t type)
 {


=====================================
src/win32/dirs.c
=====================================
@@ -25,85 +25,15 @@
 # include "config.h"
 #endif
 
-#ifndef UNICODE
-#define UNICODE
-#endif
 #include <vlc_common.h>
 
-#include <direct.h>
 #include <shlobj.h>
 
-#include "../libvlc.h"
 #include <vlc_charset.h>
-#include <vlc_configuration.h>
 #include "../config/configuration.h"
 
 #include <assert.h>
-#include <limits.h>
-
-
-char *config_GetLibDir (void)
-{
-    /* Get our full path */
-    MEMORY_BASIC_INFORMATION mbi;
-    if (!VirtualQuery (config_GetLibDir, &mbi, sizeof(mbi)))
-        goto error;
-
-    wchar_t wpath[MAX_PATH];
-    if (!GetModuleFileName ((HMODULE) mbi.AllocationBase, wpath, MAX_PATH))
-        goto error;
 
-    wchar_t *file = wcsrchr (wpath, L'\\');
-    if (file == NULL)
-        goto error;
-    *file = L'\0';
-
-    return FromWide (wpath);
-error:
-    abort ();
-}
-
-static char *config_GetDataDir(void)
-{
-    const char *path = getenv ("VLC_DATA_PATH");
-    return (path != NULL) ? strdup (path) : config_GetLibDir ();
-}
-
-char *config_GetSysPath(vlc_sysdir_t type, const char *filename)
-{
-    char *dir = NULL;
-
-    switch (type)
-    {
-        case VLC_PKG_DATA_DIR:
-            dir = config_GetDataDir();
-            break;
-        case VLC_PKG_LIB_DIR:
-            dir = getenv ("VLC_LIB_PATH");
-            if (dir)
-                return strdup( dir );
-            /* fallthrough */
-        case VLC_PKG_LIBEXEC_DIR:
-            dir = config_GetLibDir();
-            break;
-        case VLC_SYSDATA_DIR:
-            break;
-        case VLC_LOCALE_DIR:
-            dir = config_GetSysPath(VLC_PKG_DATA_DIR, "locale");
-            break;
-        default:
-            vlc_assert_unreachable();
-    }
-
-    if (filename == NULL || unlikely(dir == NULL))
-        return dir;
-
-    char *path;
-    if (unlikely(asprintf(&path, "%s\\%s", dir, filename) == -1))
-        path = NULL;
-    free(dir);
-    return path;
-}
 
 static char *config_GetKnownFolder (KNOWNFOLDERID id)
 {



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/7eacdcd4c14aefd74d77bb68953bd66ec040a5d8...d557277718a801595b4e71b4e22c0365d16e40ef

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/7eacdcd4c14aefd74d77bb68953bd66ec040a5d8...d557277718a801595b4e71b4e22c0365d16e40ef
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to