Correnson Loïc a écrit : > On Win32, you may have to handle short vs long names. > For instance, 'C:\PROGRA~2' may be the same path to 'C:\Program Files', > or may be not. When using absolute paths for equality, you can go into > troubles. > L. > I just want a name that can be saved and is independent from the current directory. Testing absolute filename for equality is always a bad idea, here are a few reasons: - symbolic link - physical link - case insensitive system (like OS X) - short names on windows (the one you mentionned) However, you can store an absolute name, together with a MD5 to check if a file has changed since the last access. I think this is pretty safe. You can use the following code (which is simpler than the one I submitted previously) let absolute_name str = if Filename.is_relative str then Filename.concat (Sys.getcwd ()) str else str But it can produce filename not in "normal form" (like "/home/user/./folder/toto.ml"). Moreover, I wanted to check that the folder exists but I did not want to check is the file itself exists. So my original code is not so bad: let absolute_name str = let base = Filename.basename str in let dir = Filename.dirname str in let saved_dir = Sys.getcwd () in try Sys.chdir dir; let res = Filename.concat (Sys.getcwd ()) base in Sys.chdir saved_dir; res with | Sys_error _ -> str In fact this function is not too far from converting any filename to a unique absolute filename independent from the original filename. It deals with symbolic link for folder correctly because Sys.getcwd () gives a "real" path. It does not solve the problem of physical link (I am not sure one want to solve that one) nor the problem of case insensitive filesystem, nor symbolic link for the basename itself. Anyway, the second function above seems to suits my needs (although I have not tested it under windows yet). Cheers, Christophe