diff -ru ../yaws-1.51/src/yaws.erl src/yaws.erl --- ../yaws-1.51/src/yaws.erl 2004-12-15 14:46:38.000000000 +0100 +++ src/yaws.erl 2005-02-09 18:33:41.843184000 +0100 @@ -1590,56 +1590,28 @@ tmp_dir() -> case os:type() of {win32,_} -> - "c:/winnt/temp"; - _ -> - "/tmp" - end. - - -% Try to create a tmp directory in the current directory. -% In case of any problem terminate yaws. -% -create_tmp_dir() -> - ErrorMessage = "TEMP, and TMP variables undefined. ", - Dir = case file:get_cwd() of - {ok, CurDir} -> - CurDir ++ "/tmp"; - Err -> - io:format( - ErrorMessage++"Canont access current directory; error: ~p~n", - [Err]), - init:stop() - end, - case file:make_dir(Dir) of - ok -> Dir; - {error, eexist} -> - case file:read_file_info("tmp") of - {ok, FI} when FI#file_info.type==directory -> - Dir; - _ -> - io:format( - ErrorMessage++"Canont access directory ~p~n", - [Dir]), - init:stop() + case os:getenv("TEMP") of + false -> + case os:getenv("TMP") of + %% + %% No temporary path set? + %% Then try standard paths. + %% + false -> + case file:read_file_info("C:/WINNT/Temp") of + {error, _} -> + "C:/WINDOWS/Temp"; + {ok, _} -> + "C:/WINNT/Temp" + end; + PathTMP -> + PathTMP + end; + PathTEMP -> + PathTEMP end; - Error -> - io:format( - ErrorMessage++"Canont create directory ~p, Error: ~p~n", - [Dir,Error]), - init:stop() - end. - -% -% String represeting temporary directory that -% can be used for format functions (io,io_lib). -% WIN32 path can contain $~, so they are doubled. -% -tmp_dir_fstr() -> - lists:foldr(fun($~, Str) -> [$~, $~ | Str]; - (C , Str) -> [C | Str] - end, - [], - tmp_dir()). + _ -> "/tmp" + end. exists(F) -> case file:open(F, [read, raw]) of diff -ru ../yaws-1.51/src/yaws_server.erl src/yaws_server.erl --- ../yaws-1.51/src/yaws_server.erl 2004-12-15 14:46:38.000000000 +0100 +++ src/yaws_server.erl 2005-02-09 18:36:13.641459200 +0100 @@ -1513,8 +1513,7 @@ del_old_files([{_FileAtom, spec, _Mtime1, Spec, _}]) -> foreach( fun({mod, _, _, _, Mod, _Func}) -> - - F=yaws:tmp_dir()++"/yaws/" ++ yaws:to_list(Mod) ++ ".erl", + F=filename:join([yaws:tmp_dir(), "yaws", yaws:to_list(Mod) ++ ".erl"]), code:purge(Mod), code:purge(Mod), file:delete(F);