From 71860c88e449a85dc52b5ca7c0ae01b9202dff8b Mon Sep 17 00:00:00 2001 From: hogliux Date: Tue, 10 Apr 2018 16:48:27 +0100 Subject: [PATCH] Windows: Fixed an issue where File::getLinkedTarget could return an invalid File object on Windows although the docs state that it will return the link file itself if the link cannot be resolved --- modules/juce_core/native/juce_win32_Files.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/juce_core/native/juce_win32_Files.cpp b/modules/juce_core/native/juce_win32_Files.cpp index 8287edaa41..85e7f27a95 100644 --- a/modules/juce_core/native/juce_win32_Files.cpp +++ b/modules/juce_core/native/juce_win32_Files.cpp @@ -840,7 +840,12 @@ String File::getNativeLinkedTarget() const File File::getLinkedTarget() const { - return readWindowsShortcutOrLink (*this, true); + auto target = readWindowsShortcutOrLink (*this, true); + + if (target.isNotEmpty() && File::isAbsolutePath (target)) + return File (target); + + return *this; } bool File::createShortcut (const String& description, const File& linkFileToCreate) const