Let's say that filesystem::current_path will return the path:
/tmp/1567519419.773012
But I want a trailing separator. If seems like all I should have to do would be:
filesystem::current_path() / filesystem::path()
This works on gcc giving me:
/tmp/1567519419.773012/
But on visual-studio, while the filesystem::current_path also gives me the absolute path without a trailing seperator, dividing by filesystem::path() has no effect. The resulting path is still the absolute path without a trailing separator.
I'd like code that is cross platform compatible, and I'd like to avoid having to detect whether the current path already has a trailing separator.
Is there anything available to me?
I'm not familiar enough with
filesystemto know which compiler is correct (possibly both are, if there is implementation-defined behavior involved). However, the following should work on all platforms that correctly implementfilesystem: