News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Fix for font path label

Started by Roboron, October 10, 2020, 05:06:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Roboron

Just a small fix. Font path in font selection dialog was showing path_to_userdir + path_to_font_folder, so the game was displaying weird paths (like /home/.../simutrans//usr/share/fonts). Apparently, there is no need to concat the path_to_userdir in that section of the code (or so I think), so I just removed it.

Before / After

prissi

Since the savegame frame is used for all saves, I wonder if this does not break some other dialogues. Also the display on Linux seems very different that from WIndows.

Roboron

#2
I fail to see where others dialogs are using that (not savegame_frame, but the expanded list of paths displayed on screen). But, if this a issue, I've come with another solution: just modify the first condition to see if parameter is a path. Comparing first character should be enough (/). If we want a solution for Windows, we could compare also "C:\", but I think you have implied that the windows version don't suffer from this.

Quoteif (strncmp(name.c_str(),env_t::program_dir,program_dir_len) == 0
      || strncmp(name.c_str(),"/",1) == 0 ) {
      // starts with program_dir
      // or starts with "/" (is a unix path)
      tstrncpy(path_expanded, name.c_str(), FILENAME_MAX);
   }

That's it, same effect, no code removed.

A test follows (saves, themes, fonts, scenario). Curious to see that only save is a relative path.

QuoteOriginal path is: save/
Path expanded is: /home/rober/simutrans/save/
Original path is: /home/rober/.local/share/simutrans/themes/
Path expanded is: /home/rober/.local/share/simutrans/themes/
Original path is: /home/rober/simutrans/themes/
Path expanded is: /home/rober/simutrans/themes/
Original path is: /home/rober/.local/share/simutrans/font/
Path expanded is: /home/rober/.local/share/simutrans/font/
Original path is: /home/rober/.fonts/cantarell/
Path expanded is: /home/rober/.fonts/cantarell/
Original path is: /home/rober/.fonts/
Path expanded is: /home/rober/.fonts/
Original path is: /home/rober/.local/share/fonts/cantarell/
Path expanded is: /home/rober/.local/share/fonts/cantarell/
Original path is: /home/rober/.local/share/fonts/
Path expanded is: /home/rober/.local/share/fonts/
Original path is: /usr/share/fonts/noto-cjk/
Path expanded is: /usr/share/fonts/noto-cjk/
Original path is: /usr/share/fonts/adobe-source-code-pro/
Path expanded is: /usr/share/fonts/adobe-source-code-pro/
Original path is: /usr/share/fonts/noto/
Path expanded is: /usr/share/fonts/noto/
Original path is: /usr/share/fonts/TTF/
Path expanded is: /usr/share/fonts/TTF/
Original path is: /usr/share/fonts/cantarell/
Path expanded is: /usr/share/fonts/cantarell/
Original path is: /usr/share/fonts/gsfonts/
Path expanded is: /usr/share/fonts/gsfonts/
Original path is: /usr/share/fonts/liberation/
Path expanded is: /usr/share/fonts/liberation/
Original path is: /usr/share/fonts/
Path expanded is: /usr/share/fonts/
Original path is: /home/rober/.local/share/simutrans/pak/scenario/
Path expanded is: /home/rober/.local/share/simutrans/pak/scenario/

prissi

Sorry, now I finally see the problem. Yes, your are right, that needs fixing. Thanks, done in r9276