Drag and Drop Trouble in v1.30

Hi there,

In v1.30, filenames was not send to filesDropped function correctly.
At L1383 in juce_mac_Windowing.cpp;

 char path[2048];
 zeromem (path, sizeof (path));
 if (FSRefMakePath (&fsref, (UInt8*) path, sizeof (path) - 1) == noErr)
 {
	filenames.add (path);
 }

Why cast char* to UInt8* ?
I edited this code simply;

 UInt8* path[2048];
 zeromem (path, sizeof (path));
 if (FSRefMakePath (&fsref, (UInt8*) path, sizeof (path) - 1) == noErr)
 {
	filenames.add (String::fromUTF8(path));
 }

This code works fine.
Or I mistake something?

Best regards,
ioue

Ah yes - you’re quite right, that does look much better to me. After I added the new UTF8 methods I went through and changed a lot of these cases, but must have missed that one. Thanks!

Actually, a better way is to use the utility function for this, which would be:

    const String path (PlatformUtilities::makePathFromFSRef (&fsref));

    if (path.isNotEmpty())
        filenames.add (String::fromUTF8 (path));