61 lines
2.4 KiB
Plaintext
61 lines
2.4 KiB
Plaintext
$OpenBSD: patch-os_ml,v 1.1 2005/05/30 19:27:45 sturm Exp $
|
|
Post-release developer patch.
|
|
o Properly deal with empty directories under Windows
|
|
(workaround for a bug in Ocaml).
|
|
See http://lists.seas.upenn.edu/pipermail/unison-hackers/2005-May/000092.html
|
|
o Fix the failure of Windows client when directory or file are read-only.
|
|
See http://lists.seas.upenn.edu/pipermail/unison-hackers/2005-May/000075.html
|
|
--- os.ml.orig Mon Sep 6 15:15:46 2004
|
|
+++ os.ml Fri May 27 16:37:03 2005
|
|
@@ -150,10 +150,23 @@ and childrenOf fspath path =
|
|
loop newChildren directory
|
|
in
|
|
let absolutePath = Fspath.concat fspath path in
|
|
- let directory = Fspath.opendir absolutePath in
|
|
- let result = loop [] directory in
|
|
- Unix.closedir directory;
|
|
- result)
|
|
+ let directory =
|
|
+ try
|
|
+ Some (Fspath.opendir absolutePath)
|
|
+ with Unix.Unix_error (Unix.ENOENT, _, _) ->
|
|
+ (* FIX (in Ocaml): under Windows, when a directory is empty
|
|
+ (not even "." and ".."), FindFirstFile fails with
|
|
+ ERROR_FILE_NOT_FOUND while ocaml expects the error
|
|
+ ERROR_NO_MORE_FILES *)
|
|
+ None
|
|
+ in
|
|
+ match directory with
|
|
+ Some directory ->
|
|
+ let result = loop [] directory in
|
|
+ Unix.closedir directory;
|
|
+ result
|
|
+ | None ->
|
|
+ [])
|
|
|
|
(*****************************************************************************)
|
|
(* ACTIONS ON FILESYSTEM *)
|
|
@@ -167,14 +180,19 @@ and delete fspath path =
|
|
let absolutePath = Fspath.concatToString fspath path in
|
|
match (Fileinfo.get false fspath path).Fileinfo.typ with
|
|
`DIRECTORY ->
|
|
- Unix.chmod absolutePath 0o700;
|
|
+ begin try
|
|
+ Unix.chmod absolutePath 0o700
|
|
+ with Unix.Unix_error _ -> () end;
|
|
Safelist.iter
|
|
(fun child -> delete fspath (Path.child path child))
|
|
(childrenOf fspath path);
|
|
Unix.rmdir absolutePath
|
|
| `FILE ->
|
|
- if Util.osType <> `Unix then
|
|
- Unix.chmod absolutePath 0o600;
|
|
+ if Util.osType <> `Unix then begin
|
|
+ try
|
|
+ Unix.chmod absolutePath 0o600;
|
|
+ with Unix.Unix_error _ -> ()
|
|
+ end;
|
|
Unix.unlink absolutePath;
|
|
if Prefs.read Osx.rsrc then begin
|
|
let pathDouble = Osx.appleDoubleFile fspath path in
|