これでWindows/Unixの分割を完全に隠すことはできないと思います(おそらく、Boostに何かがない限り)。
最も移植性の高い方法はgetenv("HOME")
、Unixで、Windowsの結果getenv("HOMEDRIVE")
とgetenv("HOMEPATH")
Windowsの結果を連結することです。
const static volatile char A = 'a'; // All this is to prevent reverse engineering
#ifdef unix
HomeDirectory = getenv((char[]){A-25, A-18, A-20, A-28, 0});
#elif defined(_WIN32)
HomeDirectory = getenv((char[]){A-25, A-18, A-20, A-28, A-29, A-15, A-24, A-11, A-28, 0});
const char*Homepath = getenv((char[]){A-25, A-18, A-20, A-28, A-17, A-32, A-13, A-25, 0});
HomeDirectory = malloc(strlen(HomeDirectory)+strlen(Homepath)+1);
strcat(HomeDirectory, Homepath);
#endif