Update is unzipped into sub directroy
Whenever I update my plugin it is unzipped into the plugin folder but in a sub-directory of the same name as the plugin.
/plugins
- /my-plugin
- /my-plugin
I'm probably missing something simple, here is my set up.
info.json
{
"name" : "Newsstand",
"version" : "1.0.2",
"download_url" : "http://localhost/test/my-plugin-update-1.0.2.zip",
"sections" : {
"description" : "Newsstand API"
}
}
my-plugin.php
require 'includes/lib/plugin-update-checker/plugin-update-checker.php';
$myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
'http://localhost/test/info.json',
__FILE__,
'my-plugin'
);
Zip folder structure
/my-plugin-update-1.0.2.zip - /my-plugin
I'm using a MAC and have tried zipping the folder with various Zip applications but always get the same result.
Wordpress Version 5.5.3
While the ZIP folder structure that you've posted looks correct, my guess would still be that the problem has to do with the folder structure. There are two main possibilities:
- Could it be that there is actually an extra folder in there? Try zipping just the contents of the folder - what happens then? Normally, the update checker will not be able to install an update if the files are not in a folder. If it works in your case or you get the same problem as before, that could be a useful clue.
- Could there be a hidden file that is messing up the folder structure? For example, I think macOS creates
.DS_Storefiles sometimes, though I'm not sure why and how. Make sure that there's not a file like that at the root of your ZIP archive.
Not sure if this will help, but I use PUC with zipped files from Mac and never have any problems (although I haven't made an update in many months).
Open up Terminal and use the cd command to go to the folder where your plugin's folder is located. Then use the following command to zip it. This excludes any hidden files that start with . such as .DS_Store, .git, etc.
zip -r my-plugin-update-1.0.2.zip my-plugin -x "*/\.*"