Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent loading containers from "old" folders #258

Merged

Conversation

fieldOfView
Copy link
Contributor

This PR prevents loading containers from "old/" folders. These files are backups from the version upgrade system.

This fixes Ultimaker/Cura#1902, Ultimaker/Cura#1855, Ultimaker/Cura#1874 and many others in the forum

See Ultimaker/Cura#1902 (comment)

@Ghostkeeper
Copy link
Collaborator

Devs, see CURA-3923.

Copy link
Contributor

@awhiemstra awhiemstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pushing to get this in before 2.6 final, since I consider it a pretty big issue. Just found one small thing you may want to look at.

@@ -141,6 +141,8 @@ def getEmptyInstanceContainer(self) -> InstanceContainer:
# that were already added when the first call to this method happened will not be re-added.
def load(self) -> None:
files = []
old_file_expression = re.compile("\\" + os.sep + "old\\" + os.sep + "\d+\\" + os.sep)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to use re.compile(r"\{sep}old\{sep}\d+\{sep}".format(sep = os.sep) here since this makes it less of a string puzzle. Additionally it avoids needing to escape the slashes due to using "raw string" mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, much better.

@fieldOfView fieldOfView force-pushed the fix_prevent_loading_old_containers branch from 7e074c0 to 524d34d Compare June 12, 2017 09:51
@fieldOfView
Copy link
Contributor Author

fieldOfView commented Jun 12, 2017

Edit: fixed

@fieldOfView fieldOfView force-pushed the fix_prevent_loading_old_containers branch from 524d34d to e85ab8f Compare June 12, 2017 09:53
@awhiemstra
Copy link
Contributor

Thanks for the quick fix, merged.

@awhiemstra awhiemstra merged commit 1d17bfc into Ultimaker:2.6 Jun 12, 2017
@fieldOfView fieldOfView deleted the fix_prevent_loading_old_containers branch June 12, 2017 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants