Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. WalkthroughThe pull request extends shared path utilities and updates engine, library, and tool code to use them. The changes replace backslash-specific parsing in path operations and filename extraction. They also remove two file-transfer helpers and one library filename helper. ChangesShared path handling
Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Refactor Suggested reviewers: Merge Risk:
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
1a9d0ce7-d8fc-4873-a0c0-c8cd27bd0843
📥 Commits
Reviewing files that changed from the base of the PR and between 9176130 and 6700aad51d9f5e930cf4a9f306171a02352d2437.
📒 Files selected for processing (80)
Core/GameEngine/Include/GameNetwork/FileTransfer.hCore/GameEngine/Source/Common/Audio/AudioEventRTS.cppCore/GameEngine/Source/Common/CRCDebug.cppCore/GameEngine/Source/Common/INI/INIMapCache.cppCore/GameEngine/Source/Common/MiniLog.cppCore/GameEngine/Source/Common/System/Debug.cppCore/GameEngine/Source/Common/System/FileSystem.cppCore/GameEngine/Source/Common/System/GameMemoryInit.cppCore/GameEngine/Source/Common/WorkingDirectory.cppCore/GameEngine/Source/GameClient/MapUtil.cppCore/GameEngine/Source/GameLogic/Map/TerrainLogic.cppCore/GameEngine/Source/GameNetwork/FileTransfer.cppCore/GameEngine/Source/GameNetwork/GameInfo.cppCore/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cppCore/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cppCore/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cppCore/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cppCore/Libraries/Include/Lib/PathUtil.hCore/Libraries/Source/WWVegas/WW3D2/agg_def.cppCore/Libraries/Source/WWVegas/WW3D2/ringobj.cppCore/Libraries/Source/WWVegas/WW3D2/sphereobj.cppCore/Libraries/Source/WWVegas/WW3D2/w3d_dep.cppCore/Libraries/Source/WWVegas/WWAudio/AudibleSound.cppCore/Libraries/Source/WWVegas/WWAudio/Utils.hCore/Libraries/Source/WWVegas/WWDownload/FTP.cppCore/Libraries/Source/WWVegas/WWLib/WWCommon.hCore/Libraries/Source/WWVegas/WWLib/ffactory.cppCore/Libraries/Source/debug/debug_debug.cppCore/Libraries/Source/debug/debug_io_flat.cppCore/Libraries/Source/debug/debug_stack.cppCore/Tools/Autorun/Utils.cppCore/Tools/Autorun/Wnd_file.cppCore/Tools/ImagePacker/Source/ImagePacker.cppCore/Tools/ImagePacker/Source/WindowProcedures/DirectorySelect.cppCore/Tools/Launcher/DatGen/DatGen.cppCore/Tools/Launcher/findpatch.cppCore/Tools/Launcher/main.cppCore/Tools/Launcher/patch.cppCore/Tools/W3DView/GraphicView.cppCore/Tools/W3DView/MainFrm.cppCore/Tools/W3DView/SaveSettingsDialog.cppCore/Tools/W3DView/Utils.cppCore/Tools/W3DView/Utils.hCore/Tools/W3DView/W3DViewDoc.cppCore/Tools/WW3D/max2w3d/w3dutil.cppGenerals/Code/GameEngine/Source/Common/Recorder.cppGenerals/Code/GameEngine/Source/Common/StatsCollector.cppGenerals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cppGenerals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cppGenerals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cppGenerals/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cppGenerals/Code/Tools/GUIEdit/Source/GUIEdit.cppGenerals/Code/Tools/WorldBuilder/src/BuildList.cppGenerals/Code/Tools/WorldBuilder/src/SaveMap.cppGenerals/Code/Tools/WorldBuilder/src/ScriptDialog.cppGenerals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cppGenerals/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cppGeneralsMD/Code/GameEngine/Source/Common/Recorder.cppGeneralsMD/Code/GameEngine/Source/Common/StatsCollector.cppGeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cppGeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cppGeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/part_ldr.cppGeneralsMD/Code/Tools/GUIEdit/Source/GUIEdit.cppGeneralsMD/Code/Tools/WorldBuilder/src/BuildList.cppGeneralsMD/Code/Tools/WorldBuilder/src/MeshMoldOptions.cppGeneralsMD/Code/Tools/WorldBuilder/src/SaveMap.cppGeneralsMD/Code/Tools/WorldBuilder/src/ScriptDialog.cppGeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cppGeneralsMD/Code/Tools/WorldBuilder/src/WorldBuilderDoc.cppGeneralsMD/Code/Tools/wdump/wdump.cpp
💤 Files with no reviewable changes (2)
- Core/GameEngine/Include/GameNetwork/FileTransfer.h
- Core/GameEngine/Source/Common/System/FileSystem.cpp
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
382efc8 to
63de2c4
Compare
962122f to
5ec1b8c
Compare
5ec1b8c to
641b280
Compare
641b280 to
9abcce4
Compare
9abcce4 to
7cdd6b3
Compare
[Medium impact] The PR appears safe to merge; no new actionable issues were found.
|
xezon
left a comment
There was a problem hiding this comment.
Are we certain this covers all call sites?
| return lastSeparator ? lastSeparator + 1 : path; | ||
| } | ||
|
|
||
| inline bool appendPathSeparator(char* path, size_t size) |
There was a problem hiding this comment.
Can you make this a template functions for both char types?
There was a problem hiding this comment.
Done, it's a template for both char types now.
| return lastSeparator ? lastSeparator + 1 : path; | ||
| } | ||
|
|
||
| inline bool appendPathSeparator(char* path, size_t size) |
There was a problem hiding this comment.
The placement in this file looks not optimal, because it unfavourably squeezed between getFileName and getExtension.
There was a problem hiding this comment.
Moved it to the end of the file after getExtension.
| __inline void Delimit_Path (CString &path) | ||
| { | ||
| if (!isPathSeparator (path[::lstrlen (path) - 1])) { | ||
| if (::lstrlen (path) > 0 && !isPathSeparator (path[::lstrlen (path) - 1])) { |
There was a problem hiding this comment.
Move 2x lstrlen out condition and reuse result.
There was a problem hiding this comment.
Done, lstrlen is called once now.
| return lastSeparator ? lastSeparator + 1 : path; | ||
| } | ||
|
|
||
| inline bool appendPathSeparator(char* path, size_t size) |
There was a problem hiding this comment.
Maybe we should return the new length as well? It is used at a few call sites.
struct AppendPathSeparatorResult
{
bool ok;
size_t length;
};There was a problem hiding this comment.
Done, it returns EnsureTrailingSeparatorInPathResult with ok and length now. ffactory uses the length instead of calling strlen again.
| return lastSeparator ? lastSeparator + 1 : path; | ||
| } | ||
|
|
||
| inline bool appendPathSeparator(char* path, size_t size) |
There was a problem hiding this comment.
appendPathSeparator implies that a path separator is appended. But that is not always true: when strlen is 0 or it already ends with a path sep, then no path sep is appended but the function returns true. Maybe it needs a different name? For example ensureTrailingSeparatorInPath.
Maybe also add a description comment.
There was a problem hiding this comment.
Renamed it to ensureTrailingSeparatorInPath and added a description comment.
|
No, not all of them. Autorun/Utils.cpp:397 and :407 (Path_Add_Back_Slash) and W3DView/Utils.h:65 and :72 (Delimit_Path) still do it by hand, because they take a path with no buffer size. The Babylon and DatGen strcat calls have no existing-separator check, so I left them. If you want the unsized ones covered too, I'll add overloads for them. |
…atorInPath and return the path length
Follow up to #3362. Merge that first.
Adds appendPathSeparator to PathUtil.h. It appends the native separator when the path does not already end with one. Replaces the hand-written trailing separator checks in ImagePacker, W3DView, Autorun, WWLib, WW3D2 and WorldBuilder.
TODO: Replicate in Generals.