patchBattle for Wesnoth - Patches: patch #3591, localized paths

Show feedback again

patch #3591: localized paths

Submitted by:  J Tyne <jamit>
Submitted on:  Sun Jan 13 20:20:01 2013  
Priority: 5 - NormalStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Tue Feb 26 00:19:25 2013, comment #2:

My response to new information may be slow from here on out, but if the not-working parts could be narrowed down, I'll still see about tweaking up a new patch.

J Tyne <jamit>
Project Member
Fri Jan 18 06:40:30 2013, comment #1:

i tried this patch using visual studio 2008.

i've relocated "My Documents" to a path containing non ansi characters ("Битва за Веснот" - russian translation for BfW).

before i set my locale to russian SHGetSpecialFolderPathA just returned question marks for all non ansi characters. everything looked fine then. your new class was able to translate the native encoding to valid UTF-8.

unfortunately it didn't work. when streams are opened deep down in some low level classes some variant of fopen is called which uses mbstowcs_s to translate the path to a w_char string (utf-16). the result was wrong (the call to MultiByteToWideChar in the system path class was fine).

i don't know yet what's causing this - maybe because this function takes the locale into acccount and wesnoth is changing the local to "english"?

this might just be a problem with the visual studio build (the official windows version of wesnoth isn't built with visual studio)

i'll continue to work on this in two weeks or so.

btw: your approach looks fine.

Max <max2008>
Sun Jan 13 20:20:01 2013, original submission:

I was looking at bug #20089 (problems with localized paths and logs of localized error messages) and an idea struck me. The problem, though, is that I do not have a development environment for Windows, and I do not use non-English Windows. So I am not able to test my idea to see if it works. Maybe if I submit it here, someone else will be able to try it out and see if it works.

The basic idea is moving a Windows-specific conversion function from savegame.cpp to filesystem.cpp, then providing a relatively simple interface for calling that conversion when dealing with the file system. Specifically, wrap a file name with "system_filename()" whenever converting between const char * (as used by OS calls) and std::string (as used by the game).

I am not sure the interface is as good as it should be, but I am curious as to whether or not the idea could work. So maybe someone can take this patch and try it out?

J Tyne <jamit>
Project Member


(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #16930:  filenames.patch added by jamit (26kB - text/x-patch - preliminary patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by max2008 (Posted a comment)
  • -unavailable- added by jamit (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Error: not logged in



    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun Jan 13 20:20:01 2013jamitAttached File-=>Added filenames.patch, #16930
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup