Although it is not necessary. Forget . Not required anymore.
2018-07-05 11:35 GMT+03:00 Kostirya <kostirya at gmail.com>:
Hello. Let's take into account Env to load files in use function?
diff -u FinalPolyML.sml_orig FinalPolyML.sml
--- FinalPolyML.sml_orig 2018-07-05 11:17:32.489398000 +0300 +++ FinalPolyML.sml 2018-07-05 11:20:20.012445000 +0300 @@ -674,6 +674,7 @@ end
val suffixes = ref ["", ".ML", ".sml"]
val paths = ref ["POLYML_LIB", "SMACKAGE_HOME", "SMACKAGE"]
(*****************************************************************************)
@@ -689,15 +690,20 @@ (* We use the functional layer and a reference here rather than TextIO.input1 because that requires locking round every read to make it thread-safe. We know there's only one thread accessing the stream so we don't need it here. *)
fun trySuffixes [] =
fun trySuffixes name [] = (* Not found - attempt to open the original and pass back the exception. *) (TextIO.getInstream(TextIO.openIn originalName), originalName)
| trySuffixes (s::l) =
| trySuffixes name (s::l) = (TextIO.getInstream(TextIO.openIn (originalName ^ s)),
originalName ^ s)
handle IO.Io _ => trySuffixes l
handle IO.Io _ => trySuffixes name l
(* First in list is the name with no suffix. *)
val (inStream, fileName) = trySuffixes("" :: ! suffixes)
fun tryPath name [] = trySuffixes name ("" :: ! suffixes)
| tryPath name (p::ps) = trySuffixes (p ^ name) ("" :: !
suffixes) handle IO.Io _ => tryPath name ps
val (inStream, fileName) = tryPath originalName (rev (foldl
(fn (p, r) => case OS.Process.getEnv p of NONE => r | SOME p => p ^ "/"::r) [""] (!paths)))
val stream = ref inStream (* Record the file name. This allows nested calls to "use" to set the correct path. *)