diff --git a/modules/juce_core/native/juce_Files_windows.cpp b/modules/juce_core/native/juce_Files_windows.cpp index e88d246713..bbfe611c29 100644 --- a/modules/juce_core/native/juce_Files_windows.cpp +++ b/modules/juce_core/native/juce_Files_windows.cpp @@ -911,7 +911,9 @@ static String readWindowsShortcutOrLink (const File& shortcut, bool wantsAbsolut if (! wantsAbsolutePath) return readWindowsLnkFile (shortcut, false); - auto* h = CreateFile (shortcut.getFullPathName().toWideCharPointer(), + static constexpr const char* prefix = R"(\\?\)"; + + auto* h = CreateFile ((prefix + shortcut.getFullPathName()).toWideCharPointer(), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); @@ -939,8 +941,6 @@ static String readWindowsShortcutOrLink (const File& shortcut, bool wantsAbsolut return buffer.data(); }(); - static constexpr const char* prefix ("\\\\?\\"); - // It turns out that GetFinalPathNameByHandleW prepends \\?\ to the path. // This is not a bug, it's a feature. See MSDN for more information. if (path.isNotEmpty())