Hot Door CORE Forum
Recent changes in Files class? Some methods seem broken. - Printable Version

+- Hot Door CORE Forum (http://hotdoorcore.com/forum)
+-- Forum: All forums (http://hotdoorcore.com/forum/forumdisplay.php?fid=1)
+--- Forum: Bugs (http://hotdoorcore.com/forum/forumdisplay.php?fid=5)
+--- Thread: Recent changes in Files class? Some methods seem broken. (/showthread.php?tid=278)



Recent changes in Files class? Some methods seem broken. - Rick Johnson - 03-31-2021

I had a callback set up to automatically install updates to plugins, but in a recent update to either CORE or macOS, it now fails because some hdi::core::Files methods no longer work. (It doesn't apply to Windows because there the current plugin file is not closed and cannot be deleted to be replaced.)

First an asynchronous GET checks for an available update. The user is asked whether to install the update, where a button callback starts another asynchronous GET to fetch the actual update. Other code creates the zip, expands its folder, and deletes the zip file without a problem.

Next I want to move the doc file to a directory in the user's Documents directory. Both locations indicated by the string variables exist per hdi::core::Files::exists().

Code:
bool OKsoFar = hdi::core::files::move(sReadMeFile, sDocsFolder);

This worked until recently. The fils and folders exist, permissions are wide open, but the method returns false and the file is not moved.

Next I want to replace the current plugin file, so I move it to the trash with with its path stored in a string variable.

Code:
OKsofar = hdi::core::files::moveToTrash(sCurrentPluginFile);

Nothing happens while stepping through the code in debug mode, but after the callback exits, the plugin file appears in the trash. The corresponding Files call to move the new plugin file from the temporary folder to the plug-ins folder fails, presumably because the old plugin file has not been removed yet.

I tried moving the update code to its own method, bookended with pushContext and popContext, but that didn't help.

I'm using CORE 0.7.8 with AI 25.2.1 under macOS 10.14.6, Xcode 10.3. Everything seemed to work fine in CORE 0.7.6.

Any suggestions would be much appreciated.