TorqueGameEngines / Torque2D

A completely free, open-source, 2D game engine built on proven torque technology.
MIT License
1.24k stars 110 forks source link

Fix a bug in Linux platform that corrupted directory names in the dumpDirectories function #36

Closed elementc closed 3 years ago

elementc commented 3 years ago

Figured out why console is broken on linux, the issue was inside the recurseDumpDirectories function.

Bug was in this source:

          if ( (basePath[dStrlen(basePath) - 1]) != '/')
        dSprintf(szPath, 1024, "%s%s", basePath, subPath);
          else
        dSprintf(szPath, 1024, "%s%s", basePath, &subPath[1]);

the whole snippet is supposed to cat basePath and subPath with a / in between them, but the else clause actually just cats basePath with subPath minus the first letter, which explains the corruption I saw in the the 32-bit build fix PR:

Module Manager: Failed to scan modules files in directory '/home/casey/Repos/Torque2D-1/editor/rojectManager'

Whole function was a bit repetitive and unclear, and whitespace was a little rough, so I went through and rewrote / reformatted it to be simpler and commented it thoroughly.

As usual, if you found this valuable, please consider applying the hacktoberfest-accepted label to the PR.

Thanks!

greenfire27 commented 3 years ago

Thanks for finding it! We can finally load the "roject" manager!