Skip to content

Commit

Permalink
Use proper temp names for diff temp files
Browse files Browse the repository at this point in the history
The previous patches (almost 20 years ago) intending to do this didn't
quite finish the job. The added bonus with proper temp names is that
they will be included in the automatic cleanup, should they be left
behind for some reason.
  • Loading branch information
tleedjarv committed Apr 22, 2024
1 parent 1394ec5 commit 1eae343
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/files.ml
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,8 @@ let rec diff root1 path1 ui1 root2 path2 ui2 showDiff id =
(fun () ->
let path1 = Update.translatePathLocal fspath1 path1 in
let (workingDir, realPath) = Fspath.findWorkingDir fspath1 path1 in
let tmppath =
Path.addSuffixToFinalName realPath (tempName "diff-") in
let tmppath = Os.tempPath ~fresh:false workingDir
(Path.addSuffixToFinalName realPath "-diff") in
Os.delete workingDir tmppath;
Lwt_unix.run
(Update.translatePath root2 path2 >>= (fun path2 ->
Expand All @@ -860,8 +860,8 @@ let rec diff root1 path1 ui1 root2 path2 ui2 showDiff id =
(fun () ->
let path2 = Update.translatePathLocal fspath2 path2 in
let (workingDir, realPath) = Fspath.findWorkingDir fspath2 path2 in
let tmppath =
Path.addSuffixToFinalName realPath "#unisondiff-" in
let tmppath = Os.tempPath ~fresh:false workingDir
(Path.addSuffixToFinalName realPath "-diff") in
Lwt_unix.run
(Update.translatePath root1 path1 >>= (fun path1 ->
(* Note that we don't need the resource fork *)
Expand Down

0 comments on commit 1eae343

Please sign in to comment.