Browse Source

When parsing arguments, try open a file in current directory first

Arthur Yefimov 2 năm trước cách đây
mục cha
commit
1ee8aadf36
1 tập tin đã thay đổi với 8 bổ sung3 xóa
  1. 8 3
      src/FreeOberon.Mod

+ 8 - 3
src/FreeOberon.Mod

@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
 along with Free Oberon.  If not, see <http://www.gnu.org/licenses/>.
 *)
 IMPORT T := TermBox, Files, Args, Utf8, Builder, Env, Debug, Graph,
-       OV, Editor, Term, FoStrings, Config, Strings, Int, Out, Kernel;
+       OV, Editor, Term, FoStrings, Config, Strings, Int, Out, Dir, Kernel;
 (** Free Oberon IDE and Compiler. Part of Free Oberon IDE internal code *)
 CONST
   (* Direction of Selection *)
@@ -974,8 +974,13 @@ BEGIN
     IF (L < 4) OR (Strings.Pos('.Mod', s, L - 4) = -1) THEN
       Strings.Append('.Mod', s)
     END;
-    (*!FIXME first check if file not exists: *)
-    Strings.Insert(Config.stdPath, 0, s)
+    IF ~Dir.FileExists(s) THEN
+      Strings.Insert(Config.stdPath, 0, s);
+      IF ~Dir.FileExists(s) THEN
+        Strings.Delete(s, 0, Strings.Length(Config.stdPath));
+        Debug.StrVal('File not found: ', s)
+      END
+    END
   END
 END ParseFileNameArg;