]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/general-scheme.cc
* stepmake/aclocal.m4 (STEPMAKE_KPATHSEA): Do not include
[lilypond.git] / lily / general-scheme.cc
index 35b834d22527c0129332f516aa13eebcbcc8ff22..eab9d896de1e9439b5ac0cd524289bc74c8de835 100644 (file)
@@ -23,6 +23,7 @@
 #include "version.hh"
 #include "dimensions.hh"
 #include "main.hh"
+#include "file-path.hh"
 
 /* MacOS S fix:
    source-file.hh includes cmath which undefines isinf and isnan
@@ -33,6 +34,22 @@ inline int my_isnan (Real r) { return isnan (r); }
 #endif
 
 
+
+LY_DEFINE (ly_find_file, "ly:find-file",
+          1, 0, 0, (SCM name),
+          "Return the absolute file name of @var{name}, "
+          "or @code{#f} if not found.")
+{
+  SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string");
+
+  String nm = ly_scm2string (name);
+  String file_name = global_path.find (nm);
+  if (file_name.is_empty ())
+    return SCM_BOOL_F;
+  
+  return scm_makfrom0str (file_name.to_str0 ());
+}
+
 /*
   Ugh. Gulped file is copied twice. (maybe thrice if you count stdio
   buffering.)
@@ -170,7 +187,7 @@ LY_DEFINE (ly_gettext, "ly:gettext",
 {
   SCM_ASSERT_TYPE (scm_is_string (string), string, SCM_ARG1,
                   __FUNCTION__, "string");
-  return scm_makfrom0str (gettext (scm_i_string_chars (string)));
+  return scm_makfrom0str (_ (scm_i_string_chars (string)).to_str0 ());
 }
 
 LY_DEFINE (ly_output_backend, "ly:output-backend",