#include <cstdio>
#include <cerrno>
+using namespace std;
#include "config.hh"
static String
dos_to_posix (String file_name)
{
- char buf[PATH_MAX];
+ char buf[PATH_MAX] = "";
char *s = file_name.get_copy_str0 ();
- /* urg, wtf? char const* argument gets modified! */
- cygwin_conv_to_posix_path (s, buf);
+ /* ugh: char const* argument gets modified. */
+ int fail = cygwin_conv_to_posix_path (s, buf);
delete s;
- return buf;
+ if (!fail)
+ return buf;
+ return file_name;
}
#endif /* __CYGWIN__ */
if (!root_.is_empty ())
s = root_ + ::to_string (ROOTSEP);
if (!dir_.is_empty ())
- s += dir_ + ::to_string (DIRSEP);
+ {
+ s += dir_;
+ if (!base_.is_empty () || !ext_.is_empty ())
+ s += ::to_string (DIRSEP);
+ }
s += base_;
if (!ext_.is_empty ())
s += ::to_string (EXTSEP) + ext_;
return s;
}
-
File_name::File_name (String file_name)
{
#ifdef __CYGWIN__