Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,7 @@ type AssemblyReference =
member x.Text = (let (AssemblyReference(_,text,_)) = x in text)
member x.ProjectReference = (let (AssemblyReference(_,_,contents)) = x in contents)
member x.SimpleAssemblyNameIs(name) =
(String.Compare(fileNameWithoutExtension x.Text, name, StringComparison.OrdinalIgnoreCase) = 0) ||
(String.Compare(fileNameWithoutExtensionWithValidate false x.Text, name, StringComparison.OrdinalIgnoreCase) = 0) ||
(let text = x.Text.ToLowerInvariant()
not (text.Contains "/") && not (text.Contains "\\") && not (text.Contains ".dll") && not (text.Contains ".exe") &&
try let aname = System.Reflection.AssemblyName(x.Text) in aname.Name = name
Expand Down
8 changes: 5 additions & 3 deletions src/utils/filename.fs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let checkPathForIllegalChars (path:string) =
let checkSuffix (x:string) (y:string) = x.EndsWith(y,System.StringComparison.Ordinal)

let hasExtensionWithValidate (validate:bool) (s:string) =
if validate then (checkPathForIllegalChars s) |> ignore
if validate then (checkPathForIllegalChars s) |> ignore
let sLen = s.Length
(sLen >= 1 && s.[sLen - 1] = '.' && s <> ".." && s <> ".")
|| Path.HasExtension(s)
Expand All @@ -56,9 +56,11 @@ let fileNameOfPath s =
checkPathForIllegalChars s
Path.GetFileName(s)

let fileNameWithoutExtension s =
checkPathForIllegalChars s
let fileNameWithoutExtensionWithValidate (validate:bool) s =
if validate then checkPathForIllegalChars s |> ignore
Path.GetFileNameWithoutExtension(s)

let fileNameWithoutExtension s = fileNameWithoutExtensionWithValidate true s

let trimQuotes (s:string) =
s.Trim( [|' '; '\"'|] )
1 change: 1 addition & 0 deletions src/utils/filename.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ val hasExtension: string -> bool
val fileNameOfPath: string -> string

/// Get the filename without extension of the given path.
val fileNameWithoutExtensionWithValidate: bool -> string -> string
val fileNameWithoutExtension: string -> string

/// Trim the quotes and spaces from either end of a string
Expand Down