Fixing 'file name too long' errors

Reviewed By: cristianoc

Differential Revision: D2894470

fb-gh-sync-id: 7eec316
master
Sam Blackshear 9 years ago committed by facebook-github-bot-7
parent f3c7125dc1
commit 7938fbb344

@ -101,6 +101,16 @@ let source_file_encoding source_file =
let crc = CRC.crc16 dir in
base ^ "." ^ crc
(** covert a long filename to a short ones by truncating the name and adding a hash *)
let get_short_filename filename =
let cutoff_length = 100 in (** if longer than cutoff, cut it and append CRC *)
let name_up_to_cutoff =
if String.length filename <= cutoff_length
then filename
else String.sub filename 0 cutoff_length in
let crc_str = CRC.crc16 filename in
name_up_to_cutoff ^ ":" ^ crc_str
let source_file_empty = Absolute ""
(** current source file *)
@ -118,7 +128,8 @@ let source_dir_to_string source_dir = source_dir
(** get the path to an internal file with the given extention (.cfg, .cg, .tenv) *)
let source_dir_get_internal_file source_dir extension =
let source_dir_name = Filename.chop_extension (Filename.basename source_dir) in
let source_dir_name =
get_short_filename (Filename.chop_extension (Filename.basename source_dir)) in
let fname = source_dir_name ^ extension in
Filename.concat source_dir fname

@ -126,6 +126,9 @@ val source_dir_from_source_file : source_file -> source_dir
(** get the path to the copy of the source file to be stored in the results directory *)
val source_file_in_resdir : source_file -> filename
(** covert a long filename to a short ones by truncating the name and adding a hash *)
val get_short_filename : string -> string
(** directory where the results of the capture phase are stored *)
val captured_dir : unit -> filename

@ -449,14 +449,7 @@ let to_simplified_string ?(withclass = false) p =
(** Convert a proc name to a filename *)
let to_filename (pn : proc_name) =
let cutoff_length = 100 in (** if longer than cutoff, cut it and append CRC *)
let name = to_unique_id pn in
let pname_up_to_cutoff =
if String.length name <= cutoff_length
then name
else String.sub name 0 cutoff_length in
let crc_str = CRC.crc16 name in
pname_up_to_cutoff ^ ":" ^ crc_str
DB.get_short_filename (to_unique_id pn)
(** Pretty print a proc name *)
let pp f pn =

Loading…
Cancel
Save