mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
File: Always interpret path as absolute in getLinkedTarget()
This fixes an issue where paths consisting of just a drive letter ("C:")
would be passed to CreateFile without a trailing path separator. The
documented behaviour in this case is for the path to be interpreted
relative to the "current directory" on that disk, so getLinkedTarget()
would incorrectly return the disk's working directory instead of the
drive root.
This commit is contained in:
parent
ba466fc11f
commit
7437e35ef5
1 changed files with 3 additions and 3 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue