Skip to content

Working with international accounts names on windows #940

@sepavel

Description

@sepavel

Hello,

PIVX can't work on windows with accounts that contains non latin symbols.
These symbols appears in paths like c:\Users<accountname>\AppData\Roaming

There are several code pieces that can be easily fixed by replacing Winapi A to W functions and char to wchar_t correspondenly

  1. src\util.cpp
    boost::filesystem::path GetTempPath()
    ..
#ifdef WIN32
    char pszPath[MAX_PATH] = "";

    if (GetTempPathA(MAX_PATH, pszPath))
        path = boost::filesystem::path(pszPath);
#else
  1. src\util
    boost::filesystem::path GetDefaultDataDir()
    ...
#ifdef WIN32
    // Windows
    return GetSpecialFolderPath(CSIDL_APPDATA) / "NetboxWallet";
#else

...

But there is one place where I don't know what to do to provide working patch
in src\init.cpp

    // Make sure only a single process is using the data directory.
    boost::filesystem::path pathLockFile = GetDataDir() / ".lock";
    FILE* file = fopen(pathLockFile.string().c_str(), "a"); // empty lock file; created if it doesn't exist.
    if (file) fclose(file);
    static boost::interprocess::file_lock lock(pathLockFile.string().c_str());

    // Wait maximum 10 seconds if an old wallet is still running. Avoids lockup during restart
    if (!lock.timed_lock(boost::get_system_time() + boost::posix_time::seconds(10)))
        return InitError(strprintf(_("Cannot obtain a lock on data directory %s

because boost::interprocess::file_lock didn't work with wide char names but only with char and paths with non latin symbols will be corrupted

Questions? Advices? Ideas?

Regards,
Pavel

Metadata

Metadata

Assignees

Labels

WindowsIssues/problems specifically related to Windows

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions