diff -a -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -N -r -u ./src/daemon/common/commonComplexOptions.ml ./src/daemon/common/commonComplexOptions.ml
--- ./src/daemon/common/commonComplexOptions.ml	2006-11-12 13:36:14.000000000 +0100
+++ ./src/daemon/common/commonComplexOptions.ml	2006-11-12 23:57:38.000000000 +0100
@@ -849,16 +849,18 @@
             in
             let shdir_priority = get_value_safe "priority" value_to_int 0
             in
+(*
             let shdir_networks = get_value_safe "networks"
                 (value_to_list value_to_string) [] 
             in
+*)
             let shdir_strategy = get_value_safe "strategy"
                 value_to_string "only_directory"
             in
             {
               shdir_dirname = shdir_dirname; 
               shdir_strategy = shdir_strategy; 
-              shdir_networks = shdir_networks; 
+              shdir_networks = []; (* shdir_networks; *)
               shdir_priority = shdir_priority; 
             }
           end
@@ -884,8 +886,10 @@
     let shared_directory_to_value s =
       let list = [
           "dirname", filename_to_value s.shdir_dirname;
+(*
           "networks", 
           list_to_value string_to_value s.shdir_networks;
+*)
           "strategy", 
           string_to_value  s.shdir_strategy;
           "priority", int_to_value s.shdir_priority;
@@ -898,8 +902,21 @@
         shared_directory_to_value
 
   end
-    
-  
+
+let default_incoming_files = {
+  shdir_dirname = Filename.concat "incoming" "files";
+  shdir_priority = 0;
+  shdir_networks = [];
+  shdir_strategy = "incoming_files";
+  }
+
+let default_incoming_directories = {
+  shdir_dirname = Filename.concat "incoming" "directories";
+  shdir_priority = 0;
+  shdir_networks = [];
+  shdir_strategy = "incoming_directories";
+  }
+
 let shared_directories = 
   define_option CommonOptions.path_section ["shared_directories" ] 
   "                Incoming and shared directories.
@@ -911,8 +928,8 @@
    Finished BT multifile downloads are committed to the first directory
    with strategy incoming_directories. Other downloads are committed
    to the first directory with the strategy incoming_files.
-   If more than one directory has one of the incoming_* strategies
-   it will be ignored on commit, but they are shared nonetheless.
+   MLdonkey searches all shared_directories with incoming_* strategies
+   on commit and uses the first one with enough free diskspace.
    Other strategies can be found in searches.ini, section customized_sharing."
     (list_option SharedDirectoryOption.t) 
   [
@@ -922,52 +939,28 @@
       shdir_networks = [];
       shdir_strategy = "all_files";
     };
-    {
-      shdir_dirname = "incoming/files";
-      shdir_priority = 0;
-      shdir_networks = [];
-      shdir_strategy = "incoming_files";
-    };
-    {
-      shdir_dirname = "incoming/directories";
-      shdir_priority = 0;
-      shdir_networks = [];
-      shdir_strategy = "incoming_directories";
-    }
+    default_incoming_files;
+    default_incoming_directories;
   ]
 
 
 let search_incoming_files () =
-  try
-    List.find_all (fun s -> s.shdir_strategy = "incoming_files") 
-    !!shared_directories
-  with Not_found ->
-        let dirname = Filename.concat "incoming" "files" in
-        let s = {
-        shdir_dirname = dirname;
-        shdir_priority = 0;
-        shdir_networks = [];
-        shdir_strategy = "incoming_files";
-          }
-        in
-        shared_directories =:= s :: !!shared_directories;
-        [s]
+  let list =
+    List.filter (fun s -> s.shdir_strategy = "incoming_files") !!shared_directories
+  in
+  match list with
+  | [] -> shared_directories =:= default_incoming_files :: !!shared_directories;
+        [default_incoming_files]
+  | l -> l
 
 let search_incoming_directories () =
-  try
-    List.find_all (fun s -> s.shdir_strategy = "incoming_directories") 
-    !!shared_directories
-  with Not_found ->
-      let dirname = Filename.concat "incoming" "directories" in
-      let s = {
-          shdir_dirname = dirname;
-          shdir_priority = 0;
-          shdir_networks = [];
-          shdir_strategy = "incoming_directories";
-        }
-      in
-      shared_directories =:= s :: !!shared_directories;
-      [s]
+  let list =
+    List.filter (fun s -> s.shdir_strategy = "incoming_directories") !!shared_directories
+  in
+  match list with
+  | [] -> shared_directories =:= default_incoming_directories :: !!shared_directories;
+        [default_incoming_directories]
+  | l -> l
 
 exception Incoming_full
 
@@ -995,7 +988,7 @@
 *)
 (* todo: make the dir naming order user configurable *)
   let compute_dir_name dir =
-    let dirname = Filename.concat dir dirname_user in
+    let dirname = Filename2.normalize (Filename.concat dir dirname_user) in
 (*    let dirname = Filename.concat dirname dirname_network in *)
     dirname
   in
diff -a -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -N -r -u ./src/daemon/common/commonTypes.ml ./src/daemon/common/commonTypes.ml
--- ./src/daemon/common/commonTypes.ml	2006-11-12 15:17:45.000000000 +0100
+++ ./src/daemon/common/commonTypes.ml	2006-11-12 23:57:25.000000000 +0100
@@ -350,7 +350,7 @@
 
 type shared_directory = {
     shdir_dirname : string;
-    shdir_priority : int;
+    mutable shdir_priority : int;
     shdir_strategy : string;
     shdir_networks : string list;
   }
diff -a -x Root -x Repository -x Tag -x Entries -x Entries.Log -x .svn -x '*.rej' -x '*.orig' -N -r -u ./src/daemon/driver/driverCommands.ml ./src/daemon/driver/driverCommands.ml
--- ./src/daemon/driver/driverCommands.ml	2006-11-09 22:32:26.000000000 +0100
+++ ./src/daemon/driver/driverCommands.ml	2006-11-12 23:57:25.000000000 +0100
@@ -2230,17 +2230,22 @@
           } in
 
         if Unix2.is_directory arg then
-          if not (List.mem shdir !!shared_directories) then begin
+	  begin
+	    try
+	      let d = List.find (fun d -> d.shdir_dirname = arg) !!shared_directories in
+	      let old_prio = d.shdir_priority in
+	      d.shdir_priority <- prio;
+	      Printf.sprintf "prio of %s changed from %d to %d"
+		d.shdir_dirname old_prio d.shdir_priority
+	    with Not_found ->
               shared_directories =:= shdir :: !!shared_directories;
               shared_add_directory shdir;
-              "directory added"
-            end (* else
-            if not (List.mem (arg, prio) !!shared_directories) then begin
-              shared_directories =:= (arg, prio) :: List.remove_assoc arg !!shared_directories;
-              shared_add_directory (arg, prio);
-              "prio changed"
-            end *) else
-            "directory already shared"
+              Printf.sprintf "directory %s added%s"
+		shdir.shdir_dirname
+		(if shdir.shdir_priority <> 0 then
+		    Printf.sprintf " with prio %d" shdir.shdir_priority
+		 else "")
+	  end
         else
           "no such directory"
     ), "<priority> <dir> [<strategy>] :\tshare directory <dir> with <priority> [and sharing strategy <strategy>]";
