]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/file-name.cc
* The grand 2005-2006 replace.
[lilypond.git] / flower / file-name.cc
index ea36d4802bfbddcd61613ce65cf34f21dfe95dbe..b75e44fdbfc559ce034f7661f9bce2cf2cf934ca 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the Flower Library
 
-  (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
@@ -11,6 +11,7 @@
 
 #include <cstdio>
 #include <cerrno>
+using namespace std;
 
 #include "config.hh"
 
@@ -22,7 +23,6 @@
 #include <sys/cygwin.h>
 #endif
 
-/* We don't have multiple roots, set this to '\0'? */
 #ifndef ROOTSEP
 #define ROOTSEP ':'
 #endif
 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__ */
 
@@ -79,7 +81,6 @@ File_name::to_string () const
   return s;
 }
 
-
 File_name::File_name (String file_name)
 {
 #ifdef __CYGWIN__
@@ -115,3 +116,12 @@ File_name::File_name (String file_name)
   else
     base_ = file_name;
 }
+
+bool
+File_name::is_absolute () const
+{
+  /*
+    Hmm. Is c:foo absolute?  
+   */
+  return (dir_.length () && dir_[0] == DIRSEP) || root_.length ();
+}