-
Notifications
You must be signed in to change notification settings - Fork 847
Closed
Description
chopextension validates path chars at start and then in has extension. This is probably a waste of cycles.
let hasExtension (s:string) =
checkPathForIllegalChars s
let sLen = s.Length
(sLen >= 1 && s.[sLen - 1] = '.' && s <> ".." && s <> ".")
|| Path.HasExtension(s)
let chopExtension (s:string) =
checkPathForIllegalChars s
if s = "." then "" else // for OCaml compatibility
if not (hasExtension s) then
raise (System.ArgumentException("chopExtension")) // message has to be precisely this, for OCaml compatibility, and no argument name can be set
Path.Combine (Path.GetDirectoryName s,Path.GetFileNameWithoutExtension(s))
Metadata
Metadata
Assignees
Labels
No labels