Bugs item #1179497, was opened at 2005-04-08 16:02 Message generated for change (Comment added) made by eiw You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1179497&group_id=31650
Category: Tasks Group: None Status: Closed Resolution: Invalid Priority: 5 Submitted By: Eric Wright (eiw) Assigned to: Gert Driesen (drieseng) Summary: DeleteTask: The directory does not exist. error Initial Comment: When using the <delete> task I get the message: [delete] Cannot delete directory 'C:\Source\SPP_Admin\SPP\bin'. The directory does not exist. when infact the directory does exist. Even though there is an error it still deletes the directory. Using failonerror avoids failure but I am still getting garabe in my log. This only happens for some directories. Here is my <delete> tasks, the first one always works while the second one doesnt. <delete dir="${build.dir}/${project.name}/bin" failonerror="false" /> <delete dir="${build.dir}/${project.name}/obj" failonerror="false" /> and here is my output: [delete] Deleting directory 'C:\Source\SPP_Admin\SPPAPI\bin'. [delete] C:\Source\SPP_Admin\SPPAPI\SPPAPI.build (60,4): [delete] Cannot delete directory 'C:\Source\SPP_Admin\SPPAPI\obj'. The directory does not exist. I also tried adding an 'if=' to the task and that doesnt change anything. I tried using the <if> task as well and here are those results: [echo] Directory C:\Source\SPP_Admin/Navigation/obj exists [delete] C:\Source\SPP_Admin\Navigation\Navigation.build(61,5): [delete] Cannot delete directory 'C:\Source\SPP_Admin\Navigation\obj'. The directory does not exist. [echo] Directory C:\Source\SPP_Admin/Navigation/bin exists [delete] Deleting directory 'C:\Source\SPP_Admin\Navigation\bin'. and here are the <if> tasks: <if test="${not directory::exists('${build.dir}/ ${project.name}/obj')}"> <echo message="Directory ${build.dir}/ ${project.name}/obj exists" /> <delete dir="${build.dir}/${project.name}/obj" failonerror="false" /> </if> <if test="${not directory::exists('${build.dir}/ ${project.name}/bin')}"> <echo message="Directory ${build.dir}/ ${project.name}/bin exists" /> <delete dir="${build.dir}/${project.name}/bin" failonerror="false" /> </if> ---------------------------------------------------------------------- >Comment By: Eric Wright (eiw) Date: 2005-04-11 11:31 Message: Logged In: YES user_id=1055420 I forgot about my exists logic, it is backwards but it worked with the not and wasnt working without it. Didnt make sense to me either... Using your example does work, and fixed my issues. Thanks. My conclusion is now that the documentation for directory:exists and file:exists could be improved. ---------------------------------------------------------------------- Comment By: Gert Driesen (drieseng) Date: 2005-04-10 09:29 Message: Logged In: YES user_id=707851 The logic of your <if> tasks does not seem correct: you're only removing directories if they do not exist. Also, in function calls you don't need to enclose property names in ${..}. Try using this: <delete dir="${build.dir}/${project.name}/bin" if="${directory::exists(build.dir + '/' + project.name + '/bin')}" /> I for one think that behaviour of the <delete> task sucks: it should not fail if the directory that you're trying to delete does not exist. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1179497&group_id=31650 ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ nant-developers mailing list nant-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-developers