X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=flower%2Ffile-path.cc;h=850592bd36280cb622f1b3fde6f12ee2f90f37a7;hb=f875ef39c544bd3499dae5360e9e24f69933575f;hp=0177d40c9f70c3ff7f5b993b0ef3b79f084adfe8;hpb=a6a4b3fc2009f17a1a48cca0c11bfd3f38645937;p=lilypond.git diff --git a/flower/file-path.cc b/flower/file-path.cc index 0177d40c9f..850592bd36 100644 --- a/flower/file-path.cc +++ b/flower/file-path.cc @@ -1,10 +1,21 @@ /* - file-path.cc - implement File_path + This file is part of LilyPond, the GNU music typesetter. - source file of the Flower Library - - (c) 1997--2008 Han-Wen Nienhuys + Copyright (C) 1997--2011 Han-Wen Nienhuys Jan Nieuwenhuizen + + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "file-path.hh" @@ -68,7 +79,7 @@ is_dir (string file_name) canonicalize; in particular, trailing slashes should disappear. */ file_name = File_name (file_name).to_string (); - + #if !STAT_MACROS_BROKEN struct stat sbuf; if (stat (file_name.c_str (), &sbuf) != 0) @@ -117,12 +128,12 @@ File_path::find (string name) const file_name.root_ = dir.root_; dir.root_ = ""; if (file_name.dir_.empty ()) - file_name.dir_ = dir.to_string (); + file_name.dir_ = dir.to_string (); else if (!dir.to_string ().empty ()) - file_name.dir_ = dir.to_string () - + ::to_string (DIRSEP) + file_name.dir_; + file_name.dir_ = dir.to_string () + + ::to_string (DIRSEP) + file_name.dir_; if (is_file (file_name.to_string ())) - return file_name.to_string (); + return file_name.to_string (); } return ""; } @@ -139,20 +150,20 @@ File_path::find (string name, char const *extensions[]) { if (name.empty () || name == "-") return name; - + File_name file_name (name); string orig_ext = file_name.ext_; for (int i = 0; extensions[i]; i++) { file_name.ext_ = orig_ext; if (*extensions[i] && !file_name.ext_.empty ()) - file_name.ext_ += "."; + file_name.ext_ += "."; file_name.ext_ += extensions[i]; string found = find (file_name.to_string ()); if (!found.empty ()) - return found; + return found; } - + return ""; } @@ -178,7 +189,7 @@ File_path::to_string () const { s = s + dirs_[i]; if (i < dirs_.size () - 1) - s += ::to_string (PATHSEP); + s += ::to_string (PATHSEP); } return s; }