Celestia icon indicating copy to clipboard operation
Celestia copied to clipboard

[1.7.0] Double backslashes in log

Open SevenSpheres opened this issue 2 years ago • 4 comments

Describe the bug File paths in Celestia's log are displayed with double backslashes.

To Reproduce Steps to reproduce the behavior:

  1. Type ~
  2. See error

Expected behavior File paths should have single backslashes.

Screenshots doublebackslash

Desktop (please complete the following information):

  • OS: Windows 10
  • Frontend: Qt, Win
  • Version: 1.7.0

Additional context Appears to be caused by #1139.

SevenSpheres avatar Oct 30 '21 20:10 SevenSpheres

This matches the behaviour of the operator << from the C++17 filesystem library, which is specified to use std::quoted and therefore renders the double backslash escape sequence.

In C++17, a potential fix to make the log output nicer would be to use the u8string() method, unfortunately this is not forward-compatible with C++20 where this returns a std::u8string (made up of char8_t) instead of a std::string (made up of char) and therefore fails to compile. It would potentially be possible to use reinterpret_cast<const char*>(path_variable.u8string().c_str()), although as far as I'm aware using the result of this as an actual pointer to const char is undefined behaviour (but it probably works on all compilers).

ajtribick avatar Oct 31 '21 22:10 ajtribick

Those .string()/.u8string() are really anoying.

375gnu avatar Nov 01 '21 18:11 375gnu

On the latest build, file paths in Celestia's log aren't displayed when a texture is successfully loaded. It's just "Creating ordinary texture..."

If a texture isn't found, the path is still displayed (with single backslashes); if a model is loaded the path is still displayed (with double backslashes).

SevenSpheres avatar Jan 01 '22 00:01 SevenSpheres

Verbosity of the message was raised from INFO to VERBOSE. There is still a lot to do to hided useless messages in default INFO mode.

375gnu avatar Jan 01 '22 10:01 375gnu