Cross-platform library for managing Windows paths?

I am writing a cross-platform application that needs to check and process Windows paths.

In particular, for the specific problem that I have now, I need to know if the path is absolute or relative.

The current code is used boost::filesystem::path, which of course works like a charm on Windows:

boost::filesystem::path the_path(the_path_as_a_string);
if (!the_path.has_root_path()) { /* do stuff */ }

The problem with this approach is that it boost::filesystem::pathhas only two modes: native and portable. This means that the Windows path grammar is not available when I compile under Linux (this is the source #ifdeffrom the source). Therefore, the path "C: \ path" is considered absolute on Windows, but relative on Linux.


Can you guys recommend a cross-platform C ++ library that can check and process Windows paths?


Currently, the only operation of the Windows path will be to check whether the path is absolute or not.

The criterion that I will use for the absolute path is that it contains the drive letter, and the path starts with \. An example of an absolute path by this criterion is C:\path. These are both examples of relative paths by this criterion: C:path, \path.

+5
source share
3 answers

It seems hard to find a library for this. One possibility is PathIsRelativein Winelib, but I do not want to use Winelib.

, . , ( ), :\, .

, , : . :\.

+1
+1

, Windows Linux?

, - Windows, Unix, boost:: filesystem .

0

All Articles