I am trying to transform a relative path and convert it to absolute to pass to SQLite using boost filesystem. This is supposed to work correctly for windows and linux
boost::filesystem::path canonical = boost::filesystem::canonical(dataPath / file);
Despite not being standard practice, forward slashes are also accepted on Windows, that's why boost isn't forcing the conversion.
However, some libraries won't accept forward slashes.
boost::filesystem::path::make_preferred() is meant to solve such situations, by converting the path to the system's preferred representation (i.e. using backslashes on Windows).
As discused below, while (most of) the Windows API accepts forward slashes, and even a mixture of forward and backslashes, some user interfaces even on applications included in Windows don't.