let guess_folder_name tool_file_loc =
let loc = extract_location tool_file_loc in
let chop_final_char s =
let ssub = String.sub s 0 ((String.length s) - 1) in
match ssub with
| Some txt -> txt
| None -> s
in
try
loc (* /path/to/netMHC-3.4a.Linux.tar.gz *)
|> Filename.basename (* netMHC-3.4a.Linux.tar.gz *)
|> Filename.chop_extension (* netMHC-3.4a.Linux.tar *)
|> Filename.chop_extension (* netMHC-3.4a.Linux *)
|> Filename.chop_extension (* netMHC-3.4a *)
|> chop_final_char (* netMHC-3.4 *)
with _ ->
ksprintf
failwith
"Error while guessing NetMHC folder name from %s"
loc