reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 91045305b185e19bd06b4c1a6da209729e20b843
parent 82a9deab606a76441e068dd4eb49aa7d1b758b2f
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Wed, 16 Dec 2015 13:08:29 -0800

fix importing files with multibyte chars in their path on Windows

Diffstat:
Msrc/reapack.cpp | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/reapack.cpp b/src/reapack.cpp @@ -89,14 +89,22 @@ void ReaPack::synchronize() void ReaPack::importRemote() { - char path[4096]; - memset(path, 0, sizeof(path)); + static const int PATH_SIZE = 4096; + char path[PATH_SIZE] = {0}; const char *title = "ReaPack: Import remote repository"; if(!GetUserFileNameForRead(path, title, "ReaPackRemote")) return; +#ifdef _WIN32 + // fixes unicode path like "C:\Users\Test\Downloads\Новая папка" on Windows + wchar_t wpath[PATH_SIZE]; + MultiByteToWideChar(CP_UTF8, 0, path, sizeof(path), wpath, PATH_SIZE); + + ifstream file(wpath); +#else ifstream file(path); +#endif if(!file) { ShowMessageBox(strerror(errno), title, 0);