Page MenuHomePhabricator

IOUtil GetProgramPath works different for nix apple/windows
Closed, InvalidPublic

Description

Event Timeline

Could you specify what the actual problem is? Do you get different behaviour for non Latin1 character sets?

Currently we can not reproduce what your patch is intended to solve.

@goch basically maybe CharToOemA should still be there, I will test how does it work in Russian paths some later. My point is slightly different here

GetProgramPath is designed to provide running application directory and so it does for Linux and Apple

However for windows there is line of code which gets index of last \ std::size_t index = std::string(path, GetModuleFileName(NULL, path, 512)).find_last_of('\\'); and then this index is not used and function is providing path including application executable which is not correct as far as I understand

Ok. As far as I can tell we can solve that issue by just creating a substring. Would this work for you?

I was just checking our own code base and it turns out we actually use that index.
https://phabricator.mitk.org/diffusion/MITK/browse/master/Modules/Core/src/IO/mitkIOUtil.cpp;642fe8135a75d47c357b90a96b5fd15af45c51a7$332-338

It seems the above pull request fixes a change you committed a while back:
https://github.com/samsmu/MITK/commit/1a4f9b75c39321146b2ba3787384c72a7da2057a

Judging from the commit message you tried to resolve some issues with russian characters. If that problem still persists with our current code we could take a look at it in a new task.

@goch yes, seems like so, sorry for disturbing about it