mgear-dev / mgear4

mGear v.4.x.x (python 3 ready) https://mgear4.readthedocs.io
MIT License
259 stars 91 forks source link

[Apple] An update reinstall fails due to .DS_Store #257

Open SimonBenAnderson opened 10 months ago

SimonBenAnderson commented 10 months ago

When updating mGear using the Drag and Drop file on a Mac device, the update fails due to .DS_Store file already existing

This is due to the OS creating these files when a folder gets a files added, or has some attributes applied to it. This results in shutil failing at https://github.com/mgear-dev/mgear4/blob/fc31ea56cde37ad68a08f8860e9069ae29fd9888/drag_n_drop_install.py#L218

SimonBenAnderson commented 10 months ago

A possible solution that results in a working install, and user feedback

We could wrap the shutil.move in a try, except and catch any OS Errors.

# -- move the folder to the install path
            try:
                shutil.move(os.path.join(
                    install_path, "mgear", item), install_path)
                self.update_logging_widget("Moved: {0}".format(
                    os.path.join(install_path, item)))
            except OSError as err:
                self.update_logging_widget("Failed to move: {0}".format(
                    os.path.join(install_path, item)))