Skip to content

Conversation

@GasDauMin
Copy link
Collaborator

Resolves #78 , resolves #80

@end2endzone
Copy link
Owner

Just for curiosity, do you know a quick way to modify the box layout characters if I need to increase the columns width ? The reasons I used -- sequences is because the layout could easily be edited with https://www.tablesgenerator.com/markdown_tables. Also the content of default.xml was partially synchronized with UserManual.md.

Copy link
Owner

@end2endzone end2endzone 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 uncertain about your proposition. I do not think that parsing the file with an XML parser is the best way to solve your problem. It is true that

your proposition is solving the issue but there are two things that I do not like:

  1. It is now duplicating the "loading" code and also duplicating the way a Configuration File is loaded. Both Configuration::IsValidConfigFile() and Configuration::LoadFile() will have to be modified if a correction is required.
  2. Each file are now parsed twice before loading. A single xml file is first parsed in Configuration::IsValidConfigFile() when validated here and then it is deleted/discarded and then a second time when it is actually loaded here.

When I have written Configuration::IsValidConfigFile() function, the purpose was to quickly discard files that were not Configuration Files. This was for performance reason. It we parse each file twice, I think it defies the performance purpose of first validating the file. I think it would be better to just load the file and see if the load is successful.

I think it would be a better idea to completely delete the function Configuration::IsValidConfigFile() and rethink how ConfigManager::Refresh() is implemented. For example, we could simply remove line 104 and let the line Configuration * config = Configuration::LoadFile(file_path, error); deal with actual file loading. If we try to load an invalid file, a NULL Configuration will be returned.

What do you think ?

@GasDauMin
Copy link
Collaborator Author

Maybe we could to leave extension check, for example I store not only xml files but also logs and icons in ShellAnything sub-forlders.

@end2endzone
Copy link
Owner

Yes. I like what you proposed. From what I understand, we should rewrite Configuration::IsValidConfigFile() to only validate based on the file's extension. This will strongly limit the possibility of loading invalid files. It wont duplicate code. If a user eventually store XML files in his configuration directory, then it shall open a new issue to solve the problem.

Please proceed with the corrections. Push your changes again to the same branch. I think GitHub will pick up the changes and update the pull request. Add a message in this PR once done (so that I will be notified by email)

@GasDauMin GasDauMin requested a review from end2endzone January 2, 2021 22:48
@GasDauMin
Copy link
Collaborator Author

In IsValidConfigFile method I left extension check only.

Copy link
Owner

@end2endzone end2endzone left a comment

Choose a reason for hiding this comment

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

Good!

@end2endzone end2endzone merged commit 05065a1 into master Jan 3, 2021
@end2endzone end2endzone deleted the feature-issue80 branch January 3, 2021 00:40
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.

Comment inside XML Syntax error in default.xml

3 participants