src/Pure/General/file_stream.ML
changeset 78716 97dfba4405e3
parent 75615 4494cd69f97f
child 78718 f34a451f7b5b
equal deleted inserted replaced
78715:9506b852ebdf 78716:97dfba4405e3
    25 local
    25 local
    26 
    26 
    27 val platform_path = ML_System.platform_path o Path.implode o Path.expand;
    27 val platform_path = ML_System.platform_path o Path.implode o Path.expand;
    28 
    28 
    29 fun with_file open_file close_file f =
    29 fun with_file open_file close_file f =
    30   Thread_Attributes.uninterruptible (fn restore_attributes => fn path =>
    30   Thread_Attributes.uninterruptible (fn run => fn path =>
    31     let
    31     let
    32       val file = open_file path;
    32       val file = open_file path;
    33       val result = Exn.capture (restore_attributes f) file;
    33       val result = Exn.capture (run f) file;
    34     in close_file file; Exn.release result end);
    34     in close_file file; Exn.release result end);
    35 
    35 
    36 in
    36 in
    37 
    37 
    38 fun open_dir f = with_file OS.FileSys.openDir OS.FileSys.closeDir f o platform_path;
    38 fun open_dir f = with_file OS.FileSys.openDir OS.FileSys.closeDir f o platform_path;