Mercurial > hg > octave-lojdl
comparison src/load-path.cc @ 6838:5e3350bdd91d
[project @ 2007-08-28 02:59:58 by jwe]
author | jwe |
---|---|
date | Tue, 28 Aug 2007 02:59:59 +0000 |
parents | 59e22e30aff8 |
children | 9398f6a81bdf |
comparison
equal
deleted
inserted
replaced
6837:7eefeed173ea | 6838:5e3350bdd91d |
---|---|
741 std::string | 741 std::string |
742 load_path::do_find_file (const std::string& file) const | 742 load_path::do_find_file (const std::string& file) const |
743 { | 743 { |
744 std::string retval; | 744 std::string retval; |
745 | 745 |
746 if (octave_env::absolute_pathname (file)) | 746 if (file.find ('/') != NPOS) |
747 { | 747 { |
748 file_stat fs (file); | 748 if (octave_env::absolute_pathname (file) |
749 | 749 || octave_env::rooted_relative_pathname (file)) |
750 if (fs.exists ()) | 750 { |
751 return file; | 751 file_stat fs (file); |
752 } | 752 |
753 | 753 if (fs.exists ()) |
754 std::string dir_name; | 754 return file; |
755 | 755 } |
756 for (const_dir_info_list_iterator p = dir_info_list.begin (); | 756 else |
757 p != dir_info_list.end (); | 757 { |
758 p++) | 758 for (const_dir_info_list_iterator p = dir_info_list.begin (); |
759 { | 759 p != dir_info_list.end (); |
760 string_vector all_files = p->all_files; | 760 p++) |
761 | 761 { |
762 octave_idx_type len = all_files.length (); | 762 std::string tfile = p->dir_name + file_ops::dir_sep_str + file; |
763 | 763 |
764 for (octave_idx_type i = 0; i < len; i++) | 764 file_stat fs (tfile); |
765 { | 765 |
766 if (all_files[i] == file) | 766 if (fs.exists ()) |
767 { | 767 return tfile; |
768 dir_name = p->dir_name; | 768 } |
769 | 769 } |
770 goto done; | 770 } |
771 } | 771 else |
772 } | 772 { |
773 } | 773 for (const_dir_info_list_iterator p = dir_info_list.begin (); |
774 | 774 p != dir_info_list.end (); |
775 done: | 775 p++) |
776 | 776 { |
777 if (! dir_name.empty ()) | 777 string_vector all_files = p->all_files; |
778 retval = dir_name + file_ops::dir_sep_str + file; | 778 |
779 octave_idx_type len = all_files.length (); | |
780 | |
781 for (octave_idx_type i = 0; i < len; i++) | |
782 { | |
783 if (all_files[i] == file) | |
784 return p->dir_name + file_ops::dir_sep_str + file; | |
785 } | |
786 } | |
787 } | |
779 | 788 |
780 return retval; | 789 return retval; |
781 } | 790 } |
782 | 791 |
783 std::string | 792 std::string |