From 208a0f7bfa5249f9795e6e225f309cbe715c0fad Mon Sep 17 00:00:00 2001 From: Samuel Mimram Date: Tue, 21 Nov 2006 21:38:49 +0000 Subject: Imported Upstream version 8.1~gamma --- ide/ideutils.ml | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'ide/ideutils.ml') diff --git a/ide/ideutils.ml b/ide/ideutils.ml index 65aef17f..df4594a7 100644 --- a/ide/ideutils.ml +++ b/ide/ideutils.ml @@ -6,7 +6,7 @@ (* * GNU Lesser General Public License Version 2.1 *) (************************************************************************) -(* $Id: ideutils.ml 8912 2006-06-07 11:20:58Z notin $ *) +(* $Id: ideutils.ml 9263 2006-10-23 12:08:08Z barras $ *) open Preferences @@ -267,7 +267,7 @@ let run_command f c = let browse f url = let l,r = !current.cmd_browse in - let (s,res) = run_command f (l ^ url ^ r) in + let (_s,_res) = run_command f (l ^ url ^ r) in () let url_for_keyword = @@ -306,18 +306,27 @@ let tab = Glib.Utf8.to_unichar "\t" (ref 0) (* - checks if two file names refer to the same (existing) file -*) + checks if two file names refer to the same (existing) file by + comparing their device and inode. + It seems that under Windows, inode is always 0, so we cannot + accurately check if -let same_file f1 f2 = +*) +(* Optimised for partial application (in case many candidates must be + compared to f1). *) +let same_file f1 = try - let s1 = Unix.stat f1 - and s2 = Unix.stat f2 - in - (s1.Unix.st_dev = s2.Unix.st_dev) && - (s1.Unix.st_ino = s2.Unix.st_ino) + let s1 = Unix.stat f1 in + (fun f2 -> + try + let s2 = Unix.stat f2 in + s1.Unix.st_dev = s2.Unix.st_dev && + if Sys.os_type = "Win32" then f1 = f2 + else s1.Unix.st_ino = s2.Unix.st_ino + with + Unix.Unix_error _ -> false) with - Unix.Unix_error _ -> false + Unix.Unix_error _ -> (fun _ -> false) let absolute_filename f = if Filename.is_relative f then -- cgit v1.2.3