-
Notifications
You must be signed in to change notification settings - Fork 23
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
Refactor codebase for clarity, portability, and consistency improvements. #256
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This change highlights that the namespace contains utility functions intended to standardize the codebase, similar to the `std` namespace.
Centralized these functions to reduce code duplication across the project. The refactored implementation ensures compatibility across all platforms.
Seems like they copied this code from somewhere to use it as a custom button control for the Launcher but it was never used. Hence there is no reason to maintain this anymore.
The previous DlgBrowsePath dialog stored recent paths by updating registry values but was difficult to use for deeply nested folders and lacked copy-paste support for paths. Switching to CFolderPickerDialog leverages Windows Explorer’s modern file dialog, simplifying path selection. This update provides a more user-friendly and modern approach, available in VS12 / MFC11 and later.
Replaced `char buff[size]` with `std::vector<char>`, enabling dynamic memory allocation for large buffers used in multi-file selection dialogs via `dlg.m_ofn.lpstrFile`. A 512 KB buffer size is used, which should accommodate even very long file paths.
Standardized header includes to address inconsistencies in case usage (some were lower-case, others upper-case), which impacts portability across platforms. Also corrected cases where system headers were included with quotes ("") instead of angle brackets (<>). Long-term, this issue could be further addressed by integrating tools like clang-tidy or include-what-you-use (iwyu).
Build passing: https://github.com/ko4life-net/ko/actions/runs/11790164397/job/32840149101 Also worth mentioning that build time almost reduced by 2 minutes 🤯 🎉 🚀 |
You're an antworker. |
UTengine
approved these changes
Nov 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine
Build passing: https://github.com/ko4life-net/ko/actions/runs/11807325401 Merging. |
srmeier
approved these changes
Nov 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces a series of codebase improvements to enhance clarity, portability, and maintainability. Key changes include namespace renaming, function refactoring, unused code removal, and consistency adjustments.
Details
Namespace Renaming: Renamed the
N3
namespace ton3std
to emphasize its role as a utility namespace for standardizing the codebase, akin to thestd
namespace.Function Refactoring: Refactored and relocated
GetProgPath
andLogFileWrite
toN3Utils.h
. This centralization reduces code duplication and ensures compatibility across all platforms.Redundant Code Removal: Removed unused and redundant code from the Launcher, which included a custom button control that was never used. Additionally, removed an unused Windows-based
ShellTree
implementation to streamline the codebase.Improved Dialog Functionality: Replaced the custom
DlgBrowsePath
dialog withCFolderPickerDialog
. The previous implementation had limitations with deeply nested folders and lacked path copy-paste functionality. UsingCFolderPickerDialog
offers a modern, user-friendly folder selection approach, leveraging Windows Explorer’s capabilities.Memory Allocation Warning Fix: Fixed warnings associated with large stack buffers by replacing
char buff[size]
withstd::vector<char>
. This change enables dynamic memory allocation for large buffers, specifically in multi-file selection dialogs, using a 512 KB buffer to support long file paths.Consistent Header Includes: Standardized header includes to improve portability and consistency. This involved addressing inconsistent casing and correcting system headers to use angle brackets (
<>
) instead of quotes (""
). Future enhancements may involve integrating tools like clang-tidy or include-what-you-use (iwyu) for further consistency.Benefits
These updates enhance the overall quality of the codebase by improving portability, reducing redundancy, ensuring compatibility, and simplifying functionality. They lay the groundwork for a more standardized, maintainable, and user-friendly application.