]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/file-name.cc
(dos_to_posix)[__CYGWIN__]: Return
[lilypond.git] / flower / file-name.cc
index 1763a546c054ca12c0715cdcf60fd3e3dbf31fde..2064e072613fa598908a01b467068f3d65512b69 100644 (file)
@@ -11,6 +11,7 @@
 
 #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__ */
 
@@ -68,14 +71,17 @@ File_name::to_string () const
   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__