Mercurial > hg > octave-nkf
comparison src/load-save.cc @ 6838:5e3350bdd91d
[project @ 2007-08-28 02:59:58 by jwe]
author | jwe |
---|---|
date | Tue, 28 Aug 2007 02:59:59 +0000 |
parents | 958713bc465e |
children | 47f4f4e88166 |
comparison
equal
deleted
inserted
replaced
6837:7eefeed173ea | 6838:5e3350bdd91d |
---|---|
592 std::string | 592 std::string |
593 find_file_to_load (const std::string& name, const std::string& orig_name) | 593 find_file_to_load (const std::string& name, const std::string& orig_name) |
594 { | 594 { |
595 std::string fname = name; | 595 std::string fname = name; |
596 | 596 |
597 if (! octave_env::absolute_pathname (fname)) | 597 if (! (octave_env::absolute_pathname (fname) |
598 || octave_env::rooted_relative_pathname (fname))) | |
598 { | 599 { |
599 file_stat fs (fname); | 600 file_stat fs (fname); |
600 | 601 |
601 if (! (fs.exists () && fs.is_reg ())) | 602 if (! (fs.exists () && fs.is_reg ())) |
602 { | 603 { |
610 fname = tmp; | 611 fname = tmp; |
611 } | 612 } |
612 } | 613 } |
613 } | 614 } |
614 | 615 |
615 if (fname.rfind (".") == NPOS) | 616 size_t dot_pos = fname.rfind ("."); |
616 { | 617 size_t sep_pos = fname.find_last_of (file_ops::dir_sep_chars); |
618 | |
619 if (dot_pos == NPOS || (sep_pos != NPOS && dot_pos < sep_pos)) | |
620 { | |
621 // Either no '.' in name or no '.' appears after last directory | |
622 // separator. | |
623 | |
617 file_stat fs (fname); | 624 file_stat fs (fname); |
618 | 625 |
619 if (! (fs.exists () && fs.is_reg ())) | 626 if (! (fs.exists () && fs.is_reg ())) |
620 fname = find_file_to_load (fname + ".mat", orig_name); | 627 fname = find_file_to_load (fname + ".mat", orig_name); |
621 } | 628 } |